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.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 3c24dc6420..10b9e27b7d 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -254,7 +254,6 @@ module ActiveRecord
end
@attributes = self.class.attributes_builder.build_from_database(defaults)
- @column_types = self.class.column_types
init_internals
initialize_internals_callback
@@ -280,7 +279,6 @@ module ActiveRecord
# post.title # => 'hello world'
def init_with(coder)
@attributes = coder['attributes']
- @column_types = self.class.column_types
init_internals
@@ -523,7 +521,9 @@ module ActiveRecord
def init_internals
pk = self.class.primary_key
- @attributes[pk] ||= Attribute.from_database(nil, type_for_attribute(pk))
+ unless @attributes.include?(pk)
+ @attributes[pk] = Attribute.from_database(nil, type_for_attribute(pk))
+ end
@aggregation_cache = {}
@association_cache = {}