From a8543830ad20be5ee1885450852fcdc02749d413 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Wed, 18 Jun 2014 05:54:55 -0600 Subject: Don't use column object when calculating type cast defaults Moves towards removing type casting knowledge from the column entirely --- activerecord/lib/active_record/model_schema.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (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 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 -- cgit v1.2.3