diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-27 11:00:02 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-27 11:00:02 -0700 |
commit | 2076efed1ca4b5df3a7101c9a478d6149bb53297 (patch) | |
tree | 2357630aa3679b43b07fc755743aa3562cefd8d6 /activerecord/lib/active_record/errors.rb | |
parent | d79ca9288e5c55563a554d05c779a41e701181cd (diff) | |
parent | ab7c1c4e0fa3d7ba51f7dd885f4cc9065652240b (diff) | |
download | rails-2076efed1ca4b5df3a7101c9a478d6149bb53297.tar.gz rails-2076efed1ca4b5df3a7101c9a478d6149bb53297.tar.bz2 rails-2076efed1ca4b5df3a7101c9a478d6149bb53297.zip |
Merge pull request #6873 from mauricio/fix-for-6825
Fixes #6825, adds tests covering cases and error possibilities
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r-- | activerecord/lib/active_record/errors.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 858b667e22..5f157fde6d 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -106,13 +106,11 @@ module ActiveRecord attr_reader :record, :attempted_action def initialize(record, attempted_action) + super("Attempted to #{attempted_action} a stale object: #{record.class.name}") @record = record @attempted_action = attempted_action end - def message - "Attempted to #{attempted_action} a stale object: #{record.class.name}" - end end # Raised when association is being configured improperly or @@ -168,9 +166,9 @@ module ActiveRecord class AttributeAssignmentError < ActiveRecordError attr_reader :exception, :attribute def initialize(message, exception, attribute) + super(message) @exception = exception @attribute = attribute - @message = message end end @@ -189,12 +187,10 @@ module ActiveRecord attr_reader :model def initialize(model) + super("Unknown primary key for table #{model.table_name} in model #{model}.") @model = model end - def message - "Unknown primary key for table #{model.table_name} in model #{model}." - end end class ImmutableRelation < ActiveRecordError |