method
initialize_dup
v4.1.8 -
Show latest stable
- Class:
ActiveRecord::Core
initialize_dup(other)public
No documentation available.
# File activerecord/lib/active_record/core.rb, line 256
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?
@aggregation_cache = {}
@association_cache = {}
@attributes_cache = {}
@new_record = true
@destroyed = false
super
end