Skip to content

Deprecate automatic counter caches on has_many :through - #15754

Merged
rafaelfranca merged 1 commit into
rails:masterfrom
sgrif:sg-deprecate-hmt-counter-cache
Jun 26, 2014
Merged

Deprecate automatic counter caches on has_many :through#15754
rafaelfranca merged 1 commit into
rails:masterfrom
sgrif:sg-deprecate-hmt-counter-cache

Conversation

@sgrif

@sgrif sgrif commented Jun 16, 2014

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Agree we should deprecate this. Could you rebase it?

@rafaelfranca

Copy link
Copy Markdown
Member

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

@sgrif

sgrif commented Jun 26, 2014

Copy link
Copy Markdown
Contributor Author

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

sgrif commented Jun 26, 2014

Copy link
Copy Markdown
Contributor Author

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