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 #15754

Merged
merged 1 commit into from
Jun 26, 2014

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jun 16, 2014

Reliant on #15747 but pulled to a
separate PR to reduce noise. has_many :through associations have the
undocumented behavior of automatically detecting counter caches.
However, the way in which it does so is inconsistent with counter caches
everywhere else, and doesn't actually work consistently.

As with normal has_many associations, the user should specify the
counter cache on the belongs_to, if they'd like it updated.

Fixes #3903

@rafaelfranca
Copy link
Member

Agree we should deprecate this. Could you rebase it?

@rafaelfranca
Copy link
Member

Oops, missing CHANGELOG/release notes entry. Could you add it?

@sgrif
Copy link
Contributor Author

sgrif commented Jun 26, 2014

Yes sorry will do
On Jun 26, 2014 3:58 AM, "Rafael Mendonça França" notifications@github.com
wrote:

Oops, missing CHANGELOG/release notes entry. Could you add it?


Reply to this email directly or view it on GitHub
#15754 (comment).

Reliant on rails#15747 but pulled to a
separate PR to reduce noise. `has_many :through` associations have the
undocumented behavior of automatically detecting counter caches.
However, the way in which it does so is inconsistent with counter caches
everywhere else, and doesn't actually work consistently.

As with normal `has_many` associations, the user should specify the
counter cache on the `belongs_to`, if they'd like it updated.
@sgrif
Copy link
Contributor Author

sgrif commented Jun 26, 2014

Updated

rafaelfranca added a commit that referenced this pull request Jun 26, 2014
Deprecate automatic counter caches on has_many :through
@rafaelfranca rafaelfranca merged commit 031588e into rails:master Jun 26, 2014
@sgrif sgrif deleted the sg-deprecate-hmt-counter-cache branch June 26, 2014 13:54
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