Displaying 1 result from an estimated 1 matches for "after_changes".
2006 Feb 22
5
Auditing mixin for model classes. Small problem
I want to include common auditing functionality in my models. This
involves storing the changes made to a model in a seperate 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....