Class: ApprovalEngine::AuditLog

Inherits:
ApplicationRecord show all
Defined in:
app/models/approval_engine/audit_log.rb

Overview

An append-only record of a single ledger event. Audit rows are write-once: they capture the intended actor (who the step was assigned to) alongside the actual actor (who acted, possibly a delegate), giving compliance teams a tamper-evident trail of every decision.

Instance Method Summary collapse

Instance Method Details

#by_proxy?Boolean

True when the acting actor differed from the assigned one — i.e. a delegate approved on someone’s behalf. A system event (no actual actor) is never a proxy.

Returns:

  • (Boolean)


19
20
21
# File 'app/models/approval_engine/audit_log.rb', line 19

def by_proxy?
  actual_actor_id.present? && intended_actor_id.present? && intended_actor != actual_actor
end

#readonly?Boolean

The ledger never rewrites history.

Returns:

  • (Boolean)


24
25
26
# File 'app/models/approval_engine/audit_log.rb', line 24

def readonly?
  persisted?
end