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

Fix `touch` option to behave consistently with `Persistence#touch` method #33107

Merged
merged 1 commit into from Jun 18, 2018

Conversation

@kamipo
Copy link
Member

@kamipo kamipo commented Jun 10, 2018

touch option was added to increment! (#27660) and update_counters
(#26995). But that option behaves inconsistently with
Persistence#touch method.

If touch option is passed attribute names, it won't update
update_at/on attributes unlike Persistence#touch method.

Due to changed from Persistence#touch to increment! with touch
option, #31405 has a regression that counter_cache with touch option
which is passed attribute names won't update update_at/on attributes.

I think that the inconsistency is not intended. To get back consistency,
ensure that touch option updates update_at/on attributes.

…thod

`touch` option was added to `increment!` (#27660) and `update_counters`
(#26995). But that option behaves inconsistently with
`Persistence#touch` method.

If `touch` option is passed attribute names, it won't update
update_at/on attributes unlike `Persistence#touch` method.

Due to changed from `Persistence#touch` to `increment!` with `touch`
option, #31405 has a regression that `counter_cache` with `touch` option
which is passed attribute names won't update update_at/on attributes.

I think that the inconsistency is not intended. To get back consistency,
ensure that `touch` option updates update_at/on attributes.
@kamipo kamipo merged commit cad0b7d into rails:master Jun 18, 2018
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kamipo kamipo deleted the kamipo:counter_cache_with_touch branch Jun 18, 2018
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.

None yet

2 participants