lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.4.0 vs lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.4.1
- old
+ new
@@ -140,13 +140,11 @@
# @return [ Many ] The relation.
#
# @since 2.0.0.rc.1
def substitute(replacement)
tap do |proxy|
- if replacement != proxy.in_memory
- proxy.purge
- proxy.push(replacement.compact.uniq) if replacement
- end
+ proxy.purge
+ proxy.push(replacement.compact.uniq) unless replacement.blank?
end
end
# Get a criteria for the documents without the default scoping
# applied.