Module: ActiveRecord::AttributeMethods::PrimaryKey
- Defined in:
- lib/composite_primary_keys/attribute_methods/primary_key.rb
Instance Method Summary collapse
-
#id_was ⇒ Object
Returns the primary key previous value.
Instance Method Details
#id_was ⇒ Object
Returns the primary key previous value.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/composite_primary_keys/attribute_methods/primary_key.rb', line 5 def id_was sync_with_transaction_state # CPK #attribute_was(self.class.primary_key) if self.composite? self.class.primary_keys.map do |key_attr| attribute_changed?(key_attr) ? changed_attributes[key_attr] : self.ids_hash[key_attr] end else attribute_was(self.class.primary_key) end end |