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

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

Instance Method Summary collapse

Instance Method Details

#before_destroyObject



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

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.



11
12
13
# File 'lib/legion/data/models/audit_record.rb', line 11

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

#parsed_metadataObject



19
20
21
22
23
24
25
26
# File 'lib/legion/data/models/audit_record.rb', line 19

def 
  return {} unless 

  Legion::JSON.load()
rescue StandardError => e
  Legion::Logging.warn "AuditRecord#parsed_metadata failed: #{e.message}" if defined?(Legion::Logging)
  {}
end