Displaying 1 result from an estimated 1 matches for "primary_key_id".
2006 Feb 22
5
Auditing mixin for model classes. Small problem
...table :
I have created the functions in an Audit module :
module Audit
before_update :before_changes
after_update :after_changes
def before_changes
old=self.class.find(id).attributes
@changes=[]
attributes.each do |key, val|
if val != old[key]
change = Change.new(:primary_key_id=>id,
:table=>self.class.table_name,
:attribute=>self.class.human_attribute_name(key),
:old=>old[key],
:new=>val)
@changes << change
end
end
end
def after_changes
if(@changes.size>0...