diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-11-07 09:00:28 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-11-07 09:03:25 +0100 |
commit | 888ea6bf4452971bdb32a92e854116c8cd053497 (patch) | |
tree | 7f9298266904c874b63cbebc8dbf6c04d8827ec5 /activerecord/lib | |
parent | 9a517b5a0b97b8872af1e66b2a5e3fd765f0d0a1 (diff) | |
parent | d424ded6fd4b923802e9dab62b463a6f3439417f (diff) | |
download | rails-888ea6bf4452971bdb32a92e854116c8cd053497.tar.gz rails-888ea6bf4452971bdb32a92e854116c8cd053497.tar.bz2 rails-888ea6bf4452971bdb32a92e854116c8cd053497.zip |
Merge pull request #17541 from OpenSourceProjects/meaninful_message
Print out a meaningful error when ActiveRecord::ReadOnlyRecord is raised
Diffstat (limited to 'activerecord/lib')
-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 9d2c9d3b9c..06c8bceb30 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -188,7 +188,7 @@ module ActiveRecord # and <tt>destroy</tt> returns +false+. See # ActiveRecord::Callbacks for further details. def destroy - raise ReadOnlyRecord if readonly? + raise ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly? destroy_associations destroy_row if persisted? @destroyed = true @@ -519,7 +519,7 @@ module ActiveRecord end def create_or_update - raise ReadOnlyRecord if readonly? + raise ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly? result = new_record? ? _create_record : _update_record result != false end |