From 4010a9ddc6d91c40cc87a30c03e8dfd9ae214dbb Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 31 Oct 2014 16:06:14 -0600 Subject: Don't modify the columns hash to set defaults from the attributes API Nothing is directly using the columns for the default values anymore. This step helps us get closer not not mutating the columns hash. --- activerecord/lib/active_record/model_schema.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/model_schema.rb') diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 31ff08a89d..a444aac23c 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -252,7 +252,7 @@ module ActiveRecord def _default_attributes # :nodoc: @default_attributes ||= attributes_builder.build_from_database( - columns_hash.transform_values(&:default)) + raw_default_values) end # Returns an array of column names as strings. @@ -331,6 +331,10 @@ module ActiveRecord base.table_name end end + + def raw_default_values + columns_hash.transform_values(&:default) + end end end end -- cgit v1.2.3