-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
The default scope isn't removed from the selector of the returned Mongoid::Criteria instance.
class Foo include Mongoid::Document embeds_many :bars end class Bar include Mongoid::Document embedded_in :foo field :flag, type: Boolean default_scope where(flag: true) end f.bars.create!(flag: true) f.bars.create!(flag: false) f.bars # => [#<Bar _id: 4e70a5f85c070f025c000003, _type: nil, flag: false>, #<Bar _id: 4e70a5fb5c070f025c000004, _type: nil, flag: true>] f.bars.all.selector # => {:flag=>true} // ok f.bars.unscoped.selector # => {:flag=>true} // wrong! should be {}