Class: Legion::Data::Model::AuditRecord

Inherits:
Object
  • Object
show all
Includes:
Logging::Helper
Defined in:
lib/legion/data/models/audit_record.rb

Instance Method Summary collapse

Methods included from Logging::Helper

#handle_exception

Instance Method Details

#before_destroyObject



19
20
21
# File 'lib/legion/data/models/audit_record.rb', line 19

def before_destroy
  raise 'audit_records are immutable and cannot be deleted'
end

#before_updateObject

Enforce append-only semantics at the application layer. PostgreSQL enforces this at the DB layer via rules (migration 058); the application guard covers SQLite and MySQL.



15
16
17
# File 'lib/legion/data/models/audit_record.rb', line 15

def before_update
  raise 'audit_records are immutable and cannot be updated'
end

#parsed_metadataObject



23
24
25
26
27
28
29
30
# File 'lib/legion/data/models/audit_record.rb', line 23

def 
  return {} unless 

  Legion::JSON.load()
rescue StandardError => e
  handle_exception(e, level: :warn, handled: true, operation: :parsed_metadata, id: self[:id])
  {}
end