aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/errors.rb
diff options
context:
space:
mode:
authorMauricio Linhares <mauricio.linhares@gmail.com>2012-06-27 14:31:22 -0300
committerMauricio Linhares <mauricio.linhares@gmail.com>2012-06-27 14:31:22 -0300
commitab7c1c4e0fa3d7ba51f7dd885f4cc9065652240b (patch)
tree2357630aa3679b43b07fc755743aa3562cefd8d6 /activerecord/lib/active_record/errors.rb
parentd79ca9288e5c55563a554d05c779a41e701181cd (diff)
downloadrails-ab7c1c4e0fa3d7ba51f7dd885f4cc9065652240b.tar.gz
rails-ab7c1c4e0fa3d7ba51f7dd885f4cc9065652240b.tar.bz2
rails-ab7c1c4e0fa3d7ba51f7dd885f4cc9065652240b.zip
Fixes #6825, adds tests covering cases and error possibilities, also changes SQLite3 driver to correctly generate a time column instead of datetime
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r--activerecord/lib/active_record/errors.rb10
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