module

PlaceOS::Model::History::Tracked

Records changes to a model in the History table.

Creates and updates are captured by pg-orm's on_persist hook, after every before_* callback and validation have run, so the entry reflects what was written. Deletes are captured by after_destroy. Entries are written in the same transaction as the change.

class Zone < ModelBase
  include History::Tracked

  history_ignore :last_seen
  history_redact :secret
end

Override history_resource_id, history_correlation_id or history_record_as to customise what is recorded.

Constants

REDACTED = JSON::Any.new("[REDACTED]")

Instance methods

change_history

Entries recorded for this record, newest first

Source
history_correlation_id

A parent the change should also be found under

Source
history_resource_id

Identifies the record in history, composite keys are joined with :

Source

Macros

history_ignore(*fields)

Fields not recorded, changes to only these fields are not recorded at all

Source
history_redact(*fields)

Fields whose values are never recorded

Source