Deprecate automatic counter caches on has_many :through #15754

Merged
merged 1 commit into from Jun 26, 2014

Conversation

Projects
None yet
2 participants
@sgrif
Member

sgrif commented Jun 16, 2014

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.

Fixes #3903

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jun 19, 2014

Member

Agree we should deprecate this. Could you rebase it?

Member

rafaelfranca commented Jun 19, 2014

Agree we should deprecate this. Could you rebase it?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jun 26, 2014

Member

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

Member

rafaelfranca commented Jun 26, 2014

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

@sgrif

This comment has been minimized.

Show comment
Hide comment
@sgrif

sgrif Jun 26, 2014

Member

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

Member

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

Deprecate automatic counter caches on has_many :through
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

This comment has been minimized.

Show comment
Hide comment
@sgrif

sgrif Jun 26, 2014

Member

Updated

Member

sgrif commented Jun 26, 2014

Updated

rafaelfranca added a commit that referenced this pull request Jun 26, 2014

Merge pull request #15754 from sgrif/sg-deprecate-hmt-counter-cache
Deprecate automatic counter caches on has_many :through

@rafaelfranca rafaelfranca merged commit 031588e into rails:master Jun 26, 2014

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