Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4429

Unexpected use of Mongoid::Matchable::Regexp in Mongoid::Document classes.

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.2.1
    • Component/s: None
    • Labels:
      None

      We have just tried to update our Mongoid version from 5.2.0 to 5.2.1, feeling that it would not cause any trouble.

      Surprisingly, we had failures in all our Mongoid::Document classes that would use the Ruby core class Regexp without explicitly using ::Regexp, as it would now match Mongoid::Matchable::Regexp instead.

      Mongoid::Document includes Composable that includes Matchable that adds Regexp.

      You should add a warning with the release note of 5.2.1 that this new Regexp class now exists and that it is not backward compatible with code that might have been referencing the core Ruby Regexp class. People need to be warned about that.

      I know that it is safer to always use ::Regexp anyway, but it is still a surprising change, simply upgrading from 5.2.0 to 5.2.1.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            sylvain-8422 Sylvain Bernier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: