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](https://makandracards.com/makandra/20301-cancel-the-activerecord-callback-chain).