diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-10-31 16:06:14 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-10-31 16:06:14 -0600 |
commit | 4010a9ddc6d91c40cc87a30c03e8dfd9ae214dbb (patch) | |
tree | b8a7aef2c520d536f84065031a43655115f43b3e /activerecord/lib/active_record/model_schema.rb | |
parent | 61bacd6ef9c302238f3b8d9e6b432ee2090f6b78 (diff) | |
download | rails-4010a9ddc6d91c40cc87a30c03e8dfd9ae214dbb.tar.gz rails-4010a9ddc6d91c40cc87a30c03e8dfd9ae214dbb.tar.bz2 rails-4010a9ddc6d91c40cc87a30c03e8dfd9ae214dbb.zip |
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.
Diffstat (limited to 'activerecord/lib/active_record/model_schema.rb')
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |