1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #15801 from sgrif/sg-column-defaults

Don't use column object when calculating type cast defaults
This commit is contained in:
Rafael Mendonça França 2014-06-19 16:59:30 -03:00
commit 357672c94c

View file

@ -236,8 +236,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