diff options
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8f011947b3..a7347c4af5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -734,6 +734,10 @@ module ActiveRecord #:nodoc: read_attribute(self.class.primary_key) end + def id_before_type_cast + read_attribute_before_type_cast(self.class.primary_key) + end + def quoted_id quote(id, self.class.columns_hash[self.class.primary_key]) end @@ -1047,7 +1051,7 @@ module ActiveRecord #:nodoc: # that instances loaded from the database would. def attributes_from_column_definition connection.columns(self.class.table_name, "#{self.class.name} Columns").inject({}) do |attributes, column| - attributes[column.name] = (column.default unless column.name == self.class.primary_key) + attributes[column.name] = column.default unless column.name == self.class.primary_key attributes end end |