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

legacy_triple_equals used incorrectly

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 8.1.0, 8.0.2, 7.5.1, 7.4.3
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      The legacy_triple_equals flag is used incorrectly in our code:

      
      def ===(other)
            if Mongoid.legacy_triple_equals
              super
            else
              other.class == Class ? self.class === other : self == other
            end
          end
      
      

      When legacy_triple_equals is true, we should use the old behavior, and when it is false, we should delegate to super. We are getting the incorrect behavior:

      
      irb(main):003:0> Band.new === Band
      => true
      irb(main):004:0> Mongoid.legacy_triple_equals
      => false
      irb(main):005:0> Mongoid.legacy_triple_equals = true
      => true
      irb(main):006:0> Band.new === Band
      => false
      
      

      Our documentation says the reverse is true. 

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: