Module: ActiveRecord::Core
- Defined in:
- lib/composite_primary_keys/core.rb
Instance Method Summary collapse
Instance Method Details
#init_internals ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/composite_primary_keys/core.rb', line 3 def init_internals pk = self.class.primary_key # CPK #@attributes[pk] = nil unless @attributes.key?(pk) unless self.composite? @attributes[pk] = nil unless @attributes.key?(pk) end @aggregation_cache = {} @association_cache = {} @attributes_cache = {} @readonly = false @destroyed = false @marked_for_destruction = false @destroyed_by_association = nil @new_record = true @txn = nil @_start_transaction_state = {} @transaction_state = nil @reflects_state = [false] end |
#initialize_dup(other) ⇒ Object
:nodoc:
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/composite_primary_keys/core.rb', line 26 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 # CPK #@attributes[self.class.primary_key] = nil Array(self.class.primary_key).each {|key| @attributes[key] = nil} run_callbacks(:initialize) unless _initialize_callbacks.empty? @aggregation_cache = {} @association_cache = {} @attributes_cache = {} @new_record = true super end |