Skip to content
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

Deprecate automatic counter caches on has_many :through #15742

Closed
wants to merge 1 commit into from

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jun 15, 2014

This functionality has been broken for a long time. We can only set it
one way. It does not update when the intermediate records are destroyed.
It is entirely duplicating the behavior of a counter_cache on the through
record. It acts inconsistently with manual counter caches.

It was proposed that we should deprecate this behavior a while back
(#3903 (comment)). I
think the time has come to do so.

Fixes #3903

This functionality has been broken for a long time. We can only set it
one way. It does not update when the intermediate records are destroyed.
It is entirely duplicating the behavior of a counter_cache on the through
record. It acts inconsistently with manual counter caches.

It was proposed that we should deprecate this behavior a while back
(rails#3903 (comment)). I
think the time has come to do so.
@matthewd
Copy link
Member

Does this negatively affect habtm?

@sgrif
Copy link
Contributor Author

sgrif commented Jun 16, 2014

HABTM doesn't support counter caches, and this weird automatic detection is undocumented.

@sgrif sgrif closed this Jun 16, 2014
@sgrif sgrif deleted the sg-deprecate-hmt-counter-cache branch June 16, 2014 15:32
@sgrif sgrif restored the sg-deprecate-hmt-counter-cache branch June 16, 2014 15:52
@sgrif sgrif deleted the sg-deprecate-hmt-counter-cache branch June 16, 2014 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

has_many :through's automatic support for counter_caches is broken
2 participants