aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/errors.rb
diff options
context:
space:
mode:
authorDmitry Polushkin <dmitry.polushkin@gmail.com>2011-10-05 17:35:59 +0100
committerDmitry Polushkin <dmitry.polushkin@gmail.com>2011-10-05 17:35:59 +0100
commit84eece0a823e9c601ea99a8709f24605a19bcbfd (patch)
tree12ac66c6404f35faddd06617987ad6db76b11406 /activerecord/lib/active_record/errors.rb
parent19965402b2f868c79d78269ca17cb6282f271382 (diff)
parentc495bfc127405f7ead0d1c275c4d75682a51e00e (diff)
downloadrails-84eece0a823e9c601ea99a8709f24605a19bcbfd.tar.gz
rails-84eece0a823e9c601ea99a8709f24605a19bcbfd.tar.bz2
rails-84eece0a823e9c601ea99a8709f24605a19bcbfd.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r--activerecord/lib/active_record/errors.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb
index ad7d8cd63c..8262b60f6e 100644
--- a/activerecord/lib/active_record/errors.rb
+++ b/activerecord/lib/active_record/errors.rb
@@ -169,4 +169,18 @@ module ActiveRecord
@errors = errors
end
end
+
+ # Raised when a model attempts to fetch its primary key from the database, but the table
+ # has no primary key declared.
+ class UnknownPrimaryKey < ActiveRecordError
+ attr_reader :model
+
+ def initialize(model)
+ @model = model
+ end
+
+ def message
+ "Unknown primary key for table #{model.table_name} in model #{model}."
+ end
+ end
end