diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6a5d282973..6106b03ba3 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1527,6 +1527,7 @@ def initialize(attributes = nil, options = {}) @marked_for_destruction = false @previously_changed = {} @changed_attributes = {} + @relation = nil ensure_proper_type set_serialized_attributes @@ -1568,6 +1569,7 @@ def encode_with(coder) # post.title # => 'hello world' def init_with(coder) @attributes = coder['attributes'] + @relation = nil set_serialized_attributes