module ActiveRecord::AttributeMethods::PrimaryKey
Public Instance Methods
id_in_database()
click to toggle source
# File lib/composite_primary_keys/attribute_methods/primary_key.rb, line 30 def id_in_database # CPK # attribute_in_database(self.class.primary_key) if self.composite? self.class.primary_keys.map do |key_attr| attribute_in_database(key_attr) end else attribute_in_database(self.class.primary_key) end end
id_was()
click to toggle source
Returns the primary key previous value.
# File lib/composite_primary_keys/attribute_methods/primary_key.rb, line 18 def id_was # 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