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

inherited models finder bug

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.16
    • Affects Version/s: None
    • Component/s: None

      While having two models, Item and Atm < Item, I'm experiencing this:

      $ rails c
      Loading development environment (Rails 3.2.9)
      irb(main):001:0> Item.all.map &:_type
      => ["Item"]
      irb(main):002:0> Atm.all.map &:_type
      => ["Atm"]
      irb(main):003:0> Item.all.map &:_type
      => ["Item", "Atm"]
      irb(main):005:0> Item.ne(_type: 'Atm').map &:_type
      => ["Item"]
      irb(main):004:0> Item.where(_type: 'Item').map &:_type
      => ["Item", "Atm"]
      irb(main):005:0> 
      

      I believe that last query should not return records with _type: 'Atm'. Actually I'm having more than one Item descendant and this is bugging me when I need to get only parent records without any subclasses.

            Assignee:
            Unassigned Unassigned
            Reporter:
            svasva svasva
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: