Skip to content

Commit

Permalink
Fix clearing of inverse fks on in memory duplicate set. [ fix mongodb…
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 25, 2012
1 parent f36e0c8 commit 289aa18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions lib/mongoid/relations/referenced/many_to_many.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 289aa18

Please sign in to comment.