diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-18 05:54:55 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-18 05:56:40 -0600 |
commit | a8543830ad20be5ee1885450852fcdc02749d413 (patch) | |
tree | 2dc9e235ccd6014e66351a536cea7f969110f07a | |
parent | dccf6da66bf4a63971e1f12b98cb1bb1fe5a9015 (diff) | |
download | rails-a8543830ad20be5ee1885450852fcdc02749d413.tar.gz rails-a8543830ad20be5ee1885450852fcdc02749d413.tar.bz2 rails-a8543830ad20be5ee1885450852fcdc02749d413.zip |
Don't use column object when calculating type cast defaults
Moves towards removing type casting knowledge from the column entirely
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index fad7eae461..7c794377e0 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -230,8 +230,8 @@ module ActiveRecord # Returns a hash where the keys are column names and the values are # default values when instantiating the AR object for this table. def column_defaults - @column_defaults ||= Hash[columns_hash.map { |name, column| - [name, column.type_cast_from_database(column.default)] + @column_defaults ||= Hash[raw_column_defaults.map { |name, default| + [name, type_for_attribute(name).type_cast_from_database(default)] }] end |