Displaying 1 result from an estimated 1 matches for "audit_changes".
2011 Jan 24
2
Seeing what has changed in ActiveRecord
...;' and ''date_of_birth'' I would like
the callback to do something only when the ''username'' or ''password''
changes or when the ''date_of_birth'' changes from nil to something
real. For example, how would I write...
before_save :audit_changes
def audit_changes
if old.username != new.username
audit("The username has changed from #{old.username} to #{new.username})
end
if old.password != new.password
audit("The user has changed their password")
end
if old.date_of_birth == nil and new.date_of_birth != ni...