Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 289aa1859202a601393099155fdc69ee19215324 1 parent f36e0c8
@durran durran authored
View
3  CHANGELOG.md
@@ -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.
View
3  lib/mongoid/relations/referenced/many_to_many.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.