diff options
-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 |