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:
parent
d47f3bcbad
commit
c827b3f15c
2 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*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]
|
* 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]
|
* Added migration support for Oracle #2647 [Michael Schoen]
|
||||||
|
|
|
@ -1139,7 +1139,7 @@ module ActiveRecord #:nodoc:
|
||||||
def id
|
def id
|
||||||
attr_name = self.class.primary_key
|
attr_name = self.class.primary_key
|
||||||
column = column_for_attribute(attr_name)
|
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
|
define_read_method(:id, attr_name, column) if self.class.generate_read_methods
|
||||||
(value = @attributes[attr_name]) && column.type_cast(value)
|
(value = @attributes[attr_name]) && column.type_cast(value)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue