Skip to content

Loading…

increment! doesn't call before_update callback #7306

Closed
mperham opened this Issue · 10 comments

6 participants

@mperham

Rails 3.2.8 breaks several tests we had around ActiveRecord increment / decrement. Specifically we aren't seeing a before_update callback triggered when we call record.increment!(:quantity, 1). The documentation says that it skips validation but says nothing about callbacks in general.

@steveklabnik
Ruby on Rails member
@mperham

Sorry for not trying out rc2. :-( :chicken:

@rafaelfranca
Ruby on Rails member

@steveklabnik this is easy to fix. Just revert this commit b081f6b.

But we need to know if is expected to increment and related method to run callbacks.

@pixeltrix
Ruby on Rails member

@rafaelfranca I thought 3.2.8 was meant to remove all deprecations introduced after 3.2.0 ?

@rafaelfranca
Ruby on Rails member

Yes, we removed the deprecation but not all the changes. See f203be9 and 81542f9.

Sorry guys. I should have reviewed this better before the release :broken_heart:

@tobsch

toggle no longer triggers before_update aswell.

@rafaelfranca rafaelfranca was assigned
@rafaelfranca rafaelfranca added a commit that closed this issue
@rafaelfranca rafaelfranca Do not use update_column where update_attribute is not interchangeable
Revert "Deprecate update_attribute."

This reverts commit b081f6b.

Reason: Since the new deprecation policy we removed the deprecation of
update_attribute but we didn't reverted the changes to use
update_column.

Fixes #7306
8055cd6
@rafaelfranca
Ruby on Rails member

@tobsch did you mean toggle!?

If so it was fixed with increment! and decrement! in my last commit.

@tobsch

yeah, sorry.

@rafbm

So… are increment and increment! supposed to execute callbacks?

@rafaelfranca
Ruby on Rails member

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.