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

rafaelfranca commented Jun 19, 2014

Agree we should deprecate this. Could you rebase it?

@rafaelfranca
Copy link
Member

rafaelfranca commented Jun 26, 2014

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 #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
1 check was pending
1 check was pending
continuous-integration/travis-ci The Travis CI build is in progress
Details
@sgrif sgrif deleted the sgrif:sg-deprecate-hmt-counter-cache branch Jun 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.