aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2008-08-14 01:44:42 +0200
committerXavier Noria <fxn@hashref.com>2008-08-14 01:44:42 +0200
commit73ef94e9675ef6db85f18f1e3c70bf6ddfc1260a (patch)
tree9e60cbba5349ff433396a84b3be1c8ab1e6e2844 /activerecord
parent37054e6eb57a1ebe330f31323d25355ff3069cb5 (diff)
downloadrails-73ef94e9675ef6db85f18f1e3c70bf6ddfc1260a.tar.gz
rails-73ef94e9675ef6db85f18f1e3c70bf6ddfc1260a.tar.bz2
rails-73ef94e9675ef6db85f18f1e3c70bf6ddfc1260a.zip
in save! docs: added a note about what happens if AR::Rollback is raised somewhere in the callback chain
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index d73d424339..cf7ae97452 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2249,8 +2249,10 @@ module ActiveRecord #:nodoc:
create_or_update
end
- # Attempts to save the record, but instead of just returning false if it couldn't happen, it raises a
- # RecordNotSaved exception
+ # Attempts to save the record, but instead of just returning false if it couldn't happen, it raises an
+ # ActiveRecord::RecordNotSaved exception. However, if the callback chain raises ActiveRecord::Rollback
+ # to rollback the transaction that wraps <tt>save!</tt> no exception is raised, <tt>save!</tt> just
+ # returns +nil+. See ActiveRecord::Callbacks for further details.
def save!
create_or_update || raise(RecordNotSaved)
end