Posted 14 days ago. Visible to the public. Linked content. Auto-destruct in 46 days

Updated: Order of the state_machine callback chain

Removed outdated callback cancelling.


  • 1. before transition
  • 2. before validation
  • 3. after validation
  • 4. before save
  • 5. after save
  • 6. after transition
  • Aborting the callback chain
  • +---------------------------
  • -- You **can** interrupt the callback chain by returning `false` in `before_transition`.
  • -- You **can not** prevent the record from being saved by manually adding an validation error during `before_transition`.
  • -- You **can** rollback the database update by raising an error in `after_transition`. The error will bubble up to the caller, no changes will be saved.
  • -- You **can not** interrupt the callback chain by returning `false` in `after_transition`.
  • -
  • -Similar cards
  • -Also see [Cancel the ActiveRecord callback chain](
  • +See [Cancel the ActiveRecord callback chain](

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Jakob Scholz
Last edit:
14 days ago
by Jakob Scholz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Jakob Scholz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more