diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-26 11:54:15 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-26 11:54:15 -0200 |
commit | cb23d6a5ee34f6f7de15174cbd7b2920d6f4c956 (patch) | |
tree | 02ed837134c62ca5f0087ce4ed3942f5683613ba /activerecord/lib/active_record/persistence.rb | |
parent | 1a35f907a975f352bd1a90bfc116415249c49393 (diff) | |
parent | 3e30c5d4222f816cdffd5241d56ef9442f6d1903 (diff) | |
download | rails-cb23d6a5ee34f6f7de15174cbd7b2920d6f4c956.tar.gz rails-cb23d6a5ee34f6f7de15174cbd7b2920d6f4c956.tar.bz2 rails-cb23d6a5ee34f6f7de15174cbd7b2920d6f4c956.zip |
Merge pull request #17674 from recursive-madman/activerecord-error-improvement
Add #record attribute to RecordNotFound and RecordDestroyed exceptions.
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index ee3b7b6163..8d84a3acae 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -139,7 +139,7 @@ module ActiveRecord # Attributes marked as readonly are silently ignored if the record is # being updated. def save!(*) - create_or_update || raise(RecordNotSaved) + create_or_update || raise(RecordNotSaved, self) end # Deletes the record in the database and freezes this instance to @@ -181,7 +181,7 @@ module ActiveRecord # and <tt>destroy!</tt> raises ActiveRecord::RecordNotDestroyed. See # ActiveRecord::Callbacks for further details. def destroy! - destroy || raise(ActiveRecord::RecordNotDestroyed) + destroy || raise(ActiveRecord::RecordNotDestroyed, self) end # Returns an instance of the specified +klass+ with the attributes of the |