Permalink
Browse files

fix clearing of inverse fks on in memory duplicate set. [ fix #2310 ]

  • Loading branch information...
1 parent f36e0c8 commit 289aa1859202a601393099155fdc69ee19215324 @durran durran committed Aug 25, 2012
Showing with 6 additions and 0 deletions.
  1. +3 −0 CHANGELOG.md
  2. +3 −0 lib/mongoid/relations/referenced/many_to_many.rb
View
@@ -10,6 +10,9 @@ For instructions on upgrading to newer versions, visit
* \#2311 `Document#changes` no longer returns `nil` values for Array and Hash
fields that were only accessed and didn't actually change. Regression from 2.4.x.
+* \#2310 Setting a many to many duplicate successively in memory no longer clears
+ the inverse foreign keys.
+
* \#2309 Allow embeds_one relations to be set with hashes more than just the
initial set.
@@ -146,6 +146,9 @@ def nullify
end
target.clear do |doc|
unbind_one(doc)
+ unless metadata.forced_nil_inverse?
+ doc.changed_attributes.delete(inverse_foreign_key)
+ end
end
end
alias :nullify_all :nullify

0 comments on commit 289aa18

Please sign in to comment.