Class: AuditedAsync::AuditAsyncJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/audited_async/audit_async_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(attributes) ⇒ Object



6
7
8
9
10
11
# File 'lib/audited_async/audit_async_job.rb', line 6

def perform(attributes)
  klass = attributes.delete(:class_name).constantize
  model = klass.find_by(klass.primary_key.to_sym => attributes.delete(:record_id))
  attributes[:audited_changes] = JSON.parse(attributes[:audited_changes])
  model.send(:write_audit, attributes)
end