-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
Let's consider the following class
class Event
include Mongoid::Document
scope :best, where(:kind.in => ['party', 'concert'])
scope :by_kind, lambda
end
When I run consoie, the following happens (look at the last result):
> Event.best
=> #<Mongoid::Criteria
selector: {:kind=>{"$in"=>["party", "concert"]}},
...
> Event.best.by_kind('party')
=> #<Mongoid::Criteria
selector: {:kind=>{"$in"=>["party"]}},
...
> Event.best
=> #<Mongoid::Criteria
selector: {:kind=>{"$in"=>["party"]}},
...
It looks like the reason of this beahavior is in this line in 'where' method:
https://github.com/mongoid/mongoid/blob/master/lib/mongoid/criterion/inclusion.rb#L164
There should be no "!" mark at the end of "merge"