class ActionAudit::Ar::UpdateObserver

Public Instance Methods

after_commit(record) click to toggle source
# File lib/action_audit/ar.rb, line 5
def after_commit(record)
  changes = record.previous_changes
  if changes.present?
    was = Hash[changes.map{|key, value| [key, value.first]}]
    become = Hash[changes.map{|key, value| [key, value.last]}]
    ActionAudit.add_change(record, was, become)
  end
rescue Exception => e
  ActionAudit.error(e)
end