aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-19 16:59:30 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-19 16:59:30 -0300
commit357672c94c84ecf1ea45f77e03cc0e6607a4fa77 (patch)
treed78710f9eddf3989d636dc2af64674bf0638fbc2
parent8996fc307a8340b175a1e9f126d485a124d7806c (diff)
parenta8543830ad20be5ee1885450852fcdc02749d413 (diff)
downloadrails-357672c94c84ecf1ea45f77e03cc0e6607a4fa77.tar.gz
rails-357672c94c84ecf1ea45f77e03cc0e6607a4fa77.tar.bz2
rails-357672c94c84ecf1ea45f77e03cc0e6607a4fa77.zip
Merge pull request #15801 from sgrif/sg-column-defaults
Don't use column object when calculating type cast defaults
-rw-r--r--activerecord/lib/active_record/model_schema.rb4
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 ffd30eb87d..099042cab2 100644
--- a/activerecord/lib/active_record/model_schema.rb
+++ b/activerecord/lib/active_record/model_schema.rb
@@ -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