method
initialize_dup
v4.0.2 -
Show latest stable
- Class:
ActiveRecord::Core
initialize_dup(other)public
No documentation available.
# File activerecord/lib/active_record/core.rb, line 243
def initialize_dup(other) # :nodoc:
cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
self.class.initialize_attributes(cloned_attributes, :serialized => false)
@attributes = cloned_attributes
@attributes[self.class.primary_key] = nil
run_callbacks(:initialize) unless _initialize_callbacks.empty?
@changed_attributes = {}
init_changed_attributes
@aggregation_cache = {}
@association_cache = {}
@attributes_cache = {}
@new_record = true
ensure_proper_type
super
end