Sha256: ff77ca069c9c9f53a05c129f4576d8007b8d2812915ef11373c233ea05f0dc5c

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

module ActiveRecord
  module Core
    def initialize_dup(other)
      cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
      self.class.initialize_attributes(cloned_attributes, :serialized => false)
      # CPK
      # cloned_attributes.delete(self.class.primary_key)
      Array(self.class.primary_key).each {|key| cloned_attributes.delete(key.to_s)}
      @attributes = cloned_attributes
      
      run_callbacks(:initialize) unless _initialize_callbacks.empty?

      @changed_attributes = {}
      self.class.column_defaults.each do |attr, orig_value|
        @changed_attributes[attr] = orig_value if _field_changed?(attr, orig_value, @attributes[attr])
      end

      @aggregation_cache = {}
      @association_cache = {}
      @attributes_cache  = {}

      @new_record  = true

      ensure_proper_type
      super
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-6.0.0 lib/composite_primary_keys/core.rb