aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 93b8e269fb..74403f9e35 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -165,6 +165,7 @@ module ActiveRecord
# User.new({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true)
def initialize(attributes = nil, options = {})
@attributes = self.class.initialize_attributes(self.class.column_defaults.dup)
+ @columns_hash = self.class.columns_hash.dup
init_internals
@@ -190,6 +191,8 @@ module ActiveRecord
# post.title # => 'hello world'
def init_with(coder)
@attributes = self.class.initialize_attributes(coder['attributes'])
+ @columns_hash = self.class.columns_hash.merge(coder['column_types'] || {})
+
init_internals
@@ -341,8 +344,6 @@ module ActiveRecord
@attributes[pk] = nil unless @attributes.key?(pk)
- @columns_hash = self.class.columns_hash.dup
-
@relation = nil
@aggregation_cache = {}
@association_cache = {}