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!` (rails#27660) and `update_counters`
(rails#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, rails#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
@kamipo kamipo deleted the counter_cache_with_touch branch June 18, 2018 10:08
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.

None yet

2 participants