diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-01 18:21:46 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-01 18:21:46 +0000 |
commit | c827b3f15cdf66da1d09eff5ad4878098933c7d6 (patch) | |
tree | ec987c83af7385eccf42c79abf6308d9da7d6757 /activerecord | |
parent | d47f3bcbade7ea9e9b66fa88d0060236d142675d (diff) | |
download | rails-c827b3f15cdf66da1d09eff5ad4878098933c7d6.tar.gz rails-c827b3f15cdf66da1d09eff5ad4878098933c7d6.tar.bz2 rails-c827b3f15cdf66da1d09eff5ad4878098933c7d6.zip |
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
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index c7f4a0ff91..efec88c651 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -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] diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d408173c01..0d9b1d4f7b 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -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 |