Class: Reeve::Audit::IsolatedEntry

Inherits:
Entry
  • Object
show all
Defined in:
lib/reeve/audit/isolated_recorder.rb

Overview

The same table and the same rules, on a pool of its own.

A subclass rather than a second model so that validations, readonly-once-persisted and the destroy guard are defined in exactly one place. The table has no inheritance column, so ActiveRecord adds no type condition and this reads and writes the same rows Entry does.

Constant Summary

Constants inherited from Entry

Entry::ALLOW, Entry::DENY, Entry::OUTCOMES, Entry::REQUIRED

Class Method Summary collapse

Methods inherited from Entry

#allowed?, contract_version, #denied?, #readonly?

Methods included from Query::Scopes

#allowed, #between, #denied, #for_agent, #for_principal, #for_tool

Class Method Details

.adapter_nameObject



104
105
106
107
108
109
110
# File 'lib/reeve/audit/isolated_recorder.rb', line 104

def adapter_name
  establish_own_connection!
  connection_pool.db_config.adapter
rescue StandardError => e
  raise Error, "could not reach the audit ledger on its own connection: " \
               "#{e.class}: #{e.message}"
end

.connection_poolObject



112
113
114
115
# File 'lib/reeve/audit/isolated_recorder.rb', line 112

def connection_pool
  establish_own_connection!
  super
end