Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

in save! docs: added a note about what happens if AR::Rollback is rai…

…sed somewhere in the callback chain
  • Loading branch information...
commit 73ef94e9675ef6db85f18f1e3c70bf6ddfc1260a 1 parent 37054e6
Xavier Noria fxn authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 activerecord/lib/active_record/base.rb
6 activerecord/lib/active_record/base.rb
View
@@ -2249,8 +2249,10 @@ def save
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
Please sign in to comment.
Something went wrong with that request. Please try again.