mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix edge guides for Active Record callbacks
This commit is contained in:
parent
c866cf9df8
commit
3820abd36d
1 changed files with 5 additions and 1 deletions
|
@ -254,7 +254,11 @@ Halting Execution
|
|||
|
||||
As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model's validations, the registered callbacks, and the database operation to be executed.
|
||||
|
||||
The whole callback chain is wrapped in a transaction. If any _before_ callback method returns exactly `false` or raises an exception, the execution chain gets halted and a ROLLBACK is issued; _after_ callbacks can only accomplish that by raising an exception.
|
||||
The whole callback chain is wrapped in a transaction. If any callback raises an exception, the execution chain gets halted and a ROLLBACK is issued. To intentionally stop a chain use:
|
||||
|
||||
```ruby
|
||||
throw :abort
|
||||
```
|
||||
|
||||
WARNING. Any exception that is not `ActiveRecord::Rollback` or `ActiveRecord::RecordInvalid` will be re-raised by Rails after the callback chain is halted. Raising an exception other than `ActiveRecord::Rollback` or `ActiveRecord::RecordInvalid` may break code that does not expect methods like `save` and `update_attributes` (which normally try to return `true` or `false`) to raise an exception.
|
||||
|
||||
|
|
Loading…
Reference in a new issue