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

5-2-stable: Fix touch option to behave consistently with Persistence#touch method #33148

Merged
merged 1 commit into from Jun 19, 2018

Conversation

kamipo
Copy link
Member

@kamipo kamipo commented Jun 18, 2018

This is a backport of #33107.

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.
@rails-bot
Copy link

warning Warning warning

  • Pull requests are usually filed against the master branch for this repo, but this one is against 5-2-stable. Please double check that you specified the right target!

@eileencodes eileencodes merged commit ea5b5f8 into rails:5-2-stable Jun 19, 2018
@kamipo kamipo deleted the backport_33107 branch June 19, 2018 12:53
rafaelfranca pushed a commit that referenced this pull request Oct 25, 2018
5-2-stable: Fix `touch` option to behave consistently with `Persistence#touch` method
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

3 participants