aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCassioMarques <cassiommc@gmail.com>2009-01-11 20:35:14 -0200
committerCassioMarques <cassiommc@gmail.com>2009-01-11 20:35:47 -0200
commitde565b7e1d2376eb1506f96723bd2e13f3f40976 (patch)
tree4b4617dcdae5bc135e65ba6222ecdfb9c987f487
parent8b63abbb08d6ba72bd15ba3910babab5a53024c3 (diff)
downloadrails-de565b7e1d2376eb1506f96723bd2e13f3f40976.tar.gz
rails-de565b7e1d2376eb1506f96723bd2e13f3f40976.tar.bz2
rails-de565b7e1d2376eb1506f96723bd2e13f3f40976.zip
Adding explanation about how the callback chain is wrapped in a transaction
-rw-r--r--railties/doc/guides/html/activerecord_validations_callbacks.html2
-rw-r--r--railties/doc/guides/source/activerecord_validations_callbacks.txt2
2 files changed, 2 insertions, 2 deletions
diff --git a/railties/doc/guides/html/activerecord_validations_callbacks.html b/railties/doc/guides/html/activerecord_validations_callbacks.html
index 5251869119..76a4ad0fa3 100644
--- a/railties/doc/guides/html/activerecord_validations_callbacks.html
+++ b/railties/doc/guides/html/activerecord_validations_callbacks.html
@@ -1262,7 +1262,7 @@ http://www.gnu.org/software/src-highlite -->
</div>
<h2 id="_halting_execution">12. Halting Execution</h2>
<div class="sectionbody">
-<div class="paragraph"><p>As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model&#8217;s validations, the registered callbacks and the database operation to be executed. However, if at any moment one of the <tt>before_create</tt>, <tt>before_save</tt>, <tt>before_update</tt> or <tt>before_destroy</tt> callback methods returns a boolean <tt>false</tt> (not <tt>nil</tt>) value, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on.</p></div>
+<div class="paragraph"><p>As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model&#8217;s validations, the registered callbacks and the database operation to be executed. However, if at any moment one of the <tt>before_create</tt>, <tt>before_save</tt>, <tt>before_update</tt> or <tt>before_destroy</tt> callback methods returns a boolean <tt>false</tt> (not <tt>nil</tt>) value or raise and exception, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on. It&#8217;s because the whole callback chain is wrapped in a transaction, so raising an exception or returning <tt>false</tt> fires a database ROLLBACK.</p></div>
</div>
<h2 id="_callback_classes">13. Callback classes</h2>
<div class="sectionbody">
diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt
index 29bff0c7b3..4dc0fdb236 100644
--- a/railties/doc/guides/source/activerecord_validations_callbacks.txt
+++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt
@@ -747,7 +747,7 @@ The +after_initialize+ and +after_find+ callbacks are a bit different from the o
== 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. However, if at any moment one of the +before_create+, +before_save+, +before_update+ or +before_destroy+ callback methods returns a boolean +false+ (not +nil+) value, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on.
+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. However, if at any moment one of the +before_create+, +before_save+, +before_update+ or +before_destroy+ callback methods returns a boolean +false+ (not +nil+) value or raise and exception, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on. It's because the whole callback chain is wrapped in a transaction, so raising an exception or returning +false+ fires a database ROLLBACK.
== Callback classes