-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #5200 #5210
Fix for #5200 #5210
Conversation
This doesn't merge properly any longer, mind updating it for HEAD? |
Ok, I merged the changes. Let me know if you need anything else from me. thanks! |
I'm not allowed to merge this, but yes, it merges cleanly now, thanks! It's all in @tenderlove or @jonleighton's hands now. |
3 months old PR, the fix looks straightforward, tests are included. Can we get some love from AR? |
This seems fine, but needs a rebase. |
…e were multiple belongs_to associations with the same foreign key.
@rafaelfranca I rebased it. Please let me know if you need anything else. thanks. |
Done |
Fix for #5200 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb
PR rails#5210 added a Friendship model to illustrate a bug, but in doing so created a confusing structure because both belongs_to declarations in Friendship referred to the same side of the join. The new structure maintains the integrity of the bug test while changing the follower relationship to be more useful for other testing.
reset_counters() was crashing when there were multiple belongs_to associations with the same foreign key.. with only one of the belongs_to associations having a custom counter_cache.
reset_counters() made the false assumption that each belongs_to association has a counter_cache.