lib/mongoid/relations/referenced/many_to_many.rb in mongoid-3.0.21 vs lib/mongoid/relations/referenced/many_to_many.rb in mongoid-3.0.22
- old
+ new
@@ -298,10 +298,10 @@
#
# @return [ Criteria ] The criteria.
#
# @since 2.1.0
def criteria(metadata, object, type = nil)
- apply_ordering(metadata.klass.all_of(_id: { "$in" => object }), metadata)
+ apply_ordering(metadata.klass.all_of(_id: { "$in" => object || [] }), metadata)
end
# Get the criteria that is used to eager load a relation of this
# type.
#