lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.2.3 vs lib/mongoid/relations/referenced/many_to_many.rb in mongoid-2.2.4
- old
+ new
@@ -140,10 +140,12 @@
# @example Nullify the relation.
# person.preferences.nullify
#
# @since 2.0.0.rc.1
def nullify
- criteria.pull(metadata.inverse_foreign_key, base.id)
+ unless metadata.forced_nil_inverse?
+ criteria.pull(metadata.inverse_foreign_key, base.id)
+ end
if persistable?
base.set(
metadata.foreign_key,
base.send(metadata.foreign_key).clear
)