aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_callbacks.md
diff options
context:
space:
mode:
authorAlessandro Dal Grande <adgror@gmail.com>2017-04-04 16:21:08 -0700
committerAlessandro Dal Grande <adgror@gmail.com>2017-04-04 16:22:46 -0700
commit3820abd36d22ac133b4146c8d59c1dda847e4f91 (patch)
tree3fcff824e2162cd1555c2b4455e85fb14318e217 /guides/source/active_record_callbacks.md
parentc866cf9df8b7d767f8be8272b120b44f453212cb (diff)
downloadrails-3820abd36d22ac133b4146c8d59c1dda847e4f91.tar.gz
rails-3820abd36d22ac133b4146c8d59c1dda847e4f91.tar.bz2
rails-3820abd36d22ac133b4146c8d59c1dda847e4f91.zip
Fix edge guides for Active Record callbacks
Diffstat (limited to 'guides/source/active_record_callbacks.md')
-rw-r--r--guides/source/active_record_callbacks.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 77bd3c97e8..de0ef7c4e5 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -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.