diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-08-24 14:34:47 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-08-24 14:34:47 +0200 |
commit | 33ed19f428953e2a372345e39ae2b37353a9e9da (patch) | |
tree | e3c3a3c54bb542717890050a3e3de787267ba1d5 /activerecord/lib/active_record/callbacks.rb | |
parent | eb2b81c766a6f9bf3c27ae0a494ae82956fb8555 (diff) | |
parent | e02f0dcc24f871d8429229db4219ee1e93636496 (diff) | |
download | rails-33ed19f428953e2a372345e39ae2b37353a9e9da.tar.gz rails-33ed19f428953e2a372345e39ae2b37353a9e9da.tar.bz2 rails-33ed19f428953e2a372345e39ae2b37353a9e9da.zip |
Merge branch 'patches'
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index be2621fdb6..eec531c514 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -169,6 +169,18 @@ module ActiveRecord # If a <tt>before_*</tt> callback returns +false+, all the later callbacks and the associated action are cancelled. If an <tt>after_*</tt> callback returns # +false+, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks # defined as methods on the model, which are called last. + # + # == Transactions + # + # The entire callback chain of a +save+, <tt>save!</tt>, or +destroy+ call runs + # within a transaction. That includes <tt>after_*</tt> hooks. If everything + # goes fine a COMMIT is executed once the chain has been completed. + # + # If a <tt>before_*</tt> callback cancels the action a ROLLBACK is issued. You + # can also trigger a ROLLBACK raising an exception in any of the callbacks, + # including <tt>after_*</tt> hooks. Note, however, that in that case the client + # needs to be aware of it because an ordinary +save+ will raise such exception + # instead of quietly returning +false+. module Callbacks CALLBACKS = %w( after_find after_initialize before_save after_save before_create after_create before_update after_update before_validation |