-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Scopes which use .also_in or .any_in should merge rather than destroy each other if you try and chain.
currently it's suggested to use in().also_in as a chain, and then chain the first one to the second scope. But that provides the bad example of implying you want the first scope all the time with the second.
>> User.collection_managers.count => 1 >> User.staff.count => 11 >> User.staff.collection_managers.count => 0 >> User.collection_managers => #<Mongoid::Criteria selector: {:roles=>{"$in"=>["collection_manager"]}}, options: {}, class: User, embedded: false> >> User.staff => #<Mongoid::Criteria selector: {:roles=>{"$in"=>["super_admin", "product_admin", "customer_admin"]}}, options: {}, class: User, embedded: false> >> User.collection_managers.staff => #<Mongoid::Criteria selector: {:roles=>{"$in"=>[]}}, options: {}, class: User, embedded: false>
these scopes should merge rather than destroy each other as they presently do.
will attach specs when i have a free minute but wanted to assign this issue for anyone searching / and to remind me