aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 6f0e71cc7b..f9de4b7918 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1598,20 +1598,20 @@ MSG
# to its need.
def initialize_dup(other)
super
+ _run_after_initialize_callbacks if respond_to?(:_run_after_initialize_callbacks)
cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
cloned_attributes.delete(self.class.primary_key)
@attributes = cloned_attributes
@changed_attributes = other.changed_attributes.dup
- @attributes_cache = {}
- @persisted = false
- _run_after_initialize_callbacks if respond_to?(:_run_after_initialize_callbacks)
clear_aggregation_cache
clear_association_cache
+ @attributes_cache = {}
+ @persisted = false
+
ensure_proper_type
populate_with_current_scope_attributes
- self
end
# Returns +true+ if the record is read only. Records loaded through joins with piggy-back