Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I took a look at issue #1360 and found out what the problem was. It seems that the latest refactoring of collection_association.rb used both create and save! to perform a create!. This caused the double-callbacks to be triggered.
The patch is essentially an unrefactoring of create! to mimic what create currently does. I had to add in an extra parameter to insert_record to use either save or save!.
I wrote a simple test to check if the callbacks were getting called more than once. It should capture the problem that was found in issue #1360.
As it stands, there are 7 other tests that are failing, but they seem to be existing problems, as ever time I've cloned I get the same 7 failures. And my modifications don't seem to change the results of those failures, so I'm fairly certain they are unrelated.
Thanks for taking a look,