Class: RailsAuditLog::AuditLogEntry

Inherits:
ApplicationRecord show all
Defined in:
app/models/rails_audit_log/audit_log_entry.rb

Constant Summary collapse

EVENTS =
%w[create update destroy].freeze

Instance Method Summary collapse

Instance Method Details

#changed_attributesObject

Instance methods



41
42
43
# File 'app/models/rails_audit_log/audit_log_entry.rb', line 41

def changed_attributes
  object_changes&.keys || []
end

#diffObject



45
46
47
48
49
# File 'app/models/rails_audit_log/audit_log_entry.rb', line 45

def diff
  return {} unless object_changes

  object_changes.transform_values { |from_to| { from: from_to[0], to: from_to[1] } }
end