1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

A missing primary key column shouldn't raise an error when generating its error message.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2837 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2005-11-01 18:21:46 +00:00
parent d47f3bcbad
commit c827b3f15c
2 changed files with 3 additions and 1 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* A missing primary key column shouldn't raise an error when generating its error message. [Don Park <don.park@gmail.com>]
* Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson]
* Added migration support for Oracle #2647 [Michael Schoen]

View file

@ -1139,7 +1139,7 @@ module ActiveRecord #:nodoc:
def id
attr_name = self.class.primary_key
column = column_for_attribute(attr_name)
raise ActiveRecordError, "No such primary key column #{attr_name} for table #{table_name}" if column.nil?
raise ActiveRecordError, "No such primary key column #{attr_name} for table #{self.class.table_name}" if column.nil?
define_read_method(:id, attr_name, column) if self.class.generate_read_methods
(value = @attributes[attr_name]) && column.type_cast(value)
end