class

PlaceOS::Model::History

Inherits Neuroplastic < PgORM::Base < PgORM::Validators < PgORM::Table < PgORM::Persistence < PgORM::Associations < ActiveModel::Callbacks < ActiveModel::Validation < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Constants

CALLBACKS = { before_save: [] of Nil, after_save: [] of Nil, before_create: [] of Nil, after_create: [] of Nil, before_update: [] of Nil, after_update: [] of Nil, before_destroy: [] of Nil, after_destroy: [] of Nil, }

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Log = ::Log.for(self)
PRIMARY_KEY_TYPES = {:id => UUID} of Nil => Nil

macro level key => type

PRIMARY_KEYS = [{:id}]

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Constructors

from_json(string_or_io : String | IO, trusted : Bool = false) : self

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

from_json(string_or_io : String | IO, root : String, trusted : Bool = false) : self

Deserializes the given JSON in string_or_io into an instance of self, assuming the JSON consists of an JSON object with key root, and whose value is the value to deserialize. Will not deserialise from fields with mass_assign: false

class User < ActiveModel::Model
  attribute name : String
  attribute google_id : UUID, mass_assign: false
end

User.from_json(%({"main": {"name": "Jason", "google_id": "f6f70bfb-c882-446d-8758-7ce47db39620"}}), root: "main") # => #<User:0x103131b20 @name="Jason">
from_trusted_json(string_or_io : String | IO, root : String) : self

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

from_trusted_json(string_or_io : String | IO) : self

Serialize from a trusted JSON source

from_trusted_yaml(string_or_io : String | IO) : self

Serialize from a trusted YAML source

from_yaml(string_or_io : String | IO, trusted : Bool = false) : self

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Source
new(pull : JSON::PullParser)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Source
new(rs : DB::ResultSet)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

new(id : UUID | ActiveModel::Model::None = ::ActiveModel::Model::None.new, resource_type : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, resource_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, correlation_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, action : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, changed_fields : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, diff : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, snapshot : JSON::Any | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_email : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, context : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Initialize PlaceOS::Model::History from HTTP::Params.

record_change(resource_type : String, resource_id : String, action : String, correlation_id : String | Nil = nil, diff : Hash(String, JSON::Any) = {} of String => JSON::Any, changed_fields : Array(String) = diff.keys, snapshot : JSON::Any | Nil = nil, metadata : Metadata | Nil = nil) : History

Records a change, then applies the retention policy

Source

Class methods

attributes

Returns all attribute keys.

changefeed_ignored_update_columns

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changes(id : UUID | Nil = nil) : ChangeFeed

Changefeed at row (if id passed) or whole table level. Returns a ChangeFeed instance which can be used to invoke async callbacks via on or use blocking Iterator via each method.

cleanup_batch
Source
cleanup_batch=(cleanup_batch : Int32)
Source
cleanup_expired(limit : Int32 = cleanup_batch) : Int32

Removes expired entries across all resources, in batches of limit.

Entries older than retention are removed beyond the newest min_entries of each resource, or entirely once the resource was deleted longer than retention ago. Returns the number removed.

Source
cleanup_interval

How often cleanup_expired runs as entries are recorded, nil disables it

Source
cleanup_interval=(cleanup_interval : Time::Span | Nil)

How often cleanup_expired runs as entries are recorded, nil disables it

Source
correlated(correlation_id : String)

Entries recorded against a parent, newest first

Source
current_metadata

Metadata of the current fiber, see with_metadata

Source
elastic
for_resource(resource_type : String, resource_id : String)

Entries of a resource, newest first

Source
from_rs(__temp_1782 : DB::ResultSet)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

max_entries
Source
max_entries=(max_entries : Int32)
Source
min_entries
Source
min_entries=(min_entries : Int32)
Source
on_error(err : Exception | IO::Error)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

primary_key

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Source
retention

Per resource, entries within retention are kept up to max_entries. Older entries are removed, except for the newest min_entries, which are kept until the resource has been deleted for longer than retention.

Source
retention=(retention : Time::Span)

Per resource, entries within retention are kept up to max_entries. Older entries are removed, except for the newest min_entries, which are kept until the resource has been deleted for longer than retention.

Source
table_name

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

trim(resource_type : String, resource_id : String) : Nil

Applies the retention policy to a single resource

Source
with_metadata(metadata : Metadata | MetadataProvider | Nil, &)

Attributes changes made by the block, including those of cascading callbacks, to metadata. A MetadataProvider is only called when a change is recorded, so it can depend on state set within the block, such as the user once a request has been authenticated.

Source

Instance methods

action

action getter

action=(value : String)

action setter

action?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

action_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

action_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

action_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

action_default

action's default value

Source
action_present?

create, update, delete, approve or restore

action_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

action_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

action_will_change!

Include action in the set of changed attributes, whether it has changed or not.

after_create

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

after_destroy

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

after_initialize(trusted : Bool)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

after_save

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

after_update

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

apply_defaults

Generate code to apply default values

assign_attributes(id : UUID | Missing = Missing, resource_type : String | Missing = Missing, resource_id : String | Missing = Missing, correlation_id : String | Nil | Missing = Missing, action : String | Missing = Missing, changed_fields : Array(String) | Missing = Missing, diff : JSON::Any | Missing = Missing, snapshot : JSON::Any | Nil | Missing = Missing, user_id : String | Nil | Missing = Missing, user_email : String | Nil | Missing = Missing, context : JSON::Any | Missing = Missing, created_at : Time | Missing = Missing)

Assign to multiple attributes.

assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))

Assign to multiple attributes via HTTP::Params.

assign_attributes(model : PlaceOS::Model::History)

Assign to multiple attributes from a model object

assign_attributes_from_json(json, root : String)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

assign_attributes_from_json(json)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

assign_attributes_from_trusted_json(json, root : String)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

assign_attributes_from_trusted_json(json)

Assign each field from JSON if field exists in JSON and has changed in model

assign_attributes_from_trusted_yaml(yaml)

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

assign_attributes_from_yaml(yaml)

Uses the YAML parser as JSON is valid YAML

attributes

Returns a Hash of all attribute values

attributes_json(io : IO) : Nil

Serialize attributes to JSON, without any other properties to_json may include, as from_json expects them.

Values are serialized as in to_json, applying any attribute converters.

attributes_json(json : JSON::Builder) : Nil

Serialize attributes to JSON, without any other properties to_json may include, as from_json expects them.

Values are serialized as in to_json, applying any attribute converters.

attributes_json

Serialize attributes to JSON, without any other properties to_json may include, as from_json expects them.

Values are serialized as in to_json, applying any attribute converters.

attributes_tuple

Returns a NamedTuple of all attribute values.

before_create

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

before_destroy

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

before_save

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

before_update

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed?

Check if any attributes have changed.

changed_attributes

Returns a Hash with all changed attributes.

changed_fields

changed_fields getter

changed_fields=(value : Array(String))

changed_fields setter

changed_fields?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

changed_fields_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed_fields_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

changed_fields_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed_fields_default

changed_fields's default value

Source
changed_fields_present?
changed_fields_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed_fields_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed_fields_will_change!

Include changed_fields in the set of changed attributes, whether it has changed or not.

changed_json(io : IO) : Nil

Serialize the set of changed attributes to JSON.

changed_json

Serialize the set of changed attributes to JSON.

changed_persist_attributes

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

changed_yaml(io : IO) : Nil

Serialize the set of changed attributes to YAML.

changed_yaml

Serialize the set of changed attributes to YAML.

changes

Returns a Hash of changed attributes, mapping each to a {previous, current} tuple.

changes_json(io : IO) : Nil

Serialize changed attributes to JSON as {"attribute": [previous, current]}.

Values are serialized as in to_json, applying any attribute converters.

changes_json(json : JSON::Builder) : Nil

Serialize changed attributes to JSON as {"attribute": [previous, current]}.

Values are serialized as in to_json, applying any attribute converters.

changes_json

Serialize changed attributes to JSON as {"attribute": [previous, current]}.

Values are serialized as in to_json, applying any attribute converters.

clear_changes_information

Reset changes for all attributes.

context

context getter

context=(value : JSON::Any)

context setter

context?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

context_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

context_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

context_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

context_default

context's default value

Source
context_present?

request details, see History::Metadata

context_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

context_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

context_will_change!

Include context in the set of changed attributes, whether it has changed or not.

correlation_id

correlation_id getter

correlation_id=(value : String | Nil)

correlation_id setter

correlation_id_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

correlation_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

correlation_id_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

correlation_id_default

correlation_id's default value

Source
correlation_id_present?
correlation_id_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

correlation_id_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

correlation_id_will_change!

Include correlation_id in the set of changed attributes, whether it has changed or not.

created_at

created_at getter

created_at=(value : Time)

created_at setter

created_at?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

created_at_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

created_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

created_at_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

created_at_default

created_at's default value

Source
created_at_present?
created_at_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

created_at_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

created_at_will_change!

Include created_at in the set of changed attributes, whether it has changed or not.

diff

diff getter

diff=(value : JSON::Any)

diff setter

diff?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

diff_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

diff_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

diff_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

diff_default

diff's default value

Source
diff_present?

{"field": [previous, current]} of the persisted changes

diff_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

diff_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

diff_will_change!

Include diff in the set of changed attributes, whether it has changed or not.

id

id getter

id=(value : UUID)

Setters id setter

id?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

id_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

id_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

id_default

id's default value

id_present?
id_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

id_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

id_will_change!

Include id in the set of changed attributes, whether it has changed or not.

invoke_props

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

metadata
Source
persistent_attributes

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

primary_key

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

Source
primary_key_hash

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_id

resource_id getter

resource_id=(value : String)

resource_id setter

resource_id?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

resource_id_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

resource_id_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_id_default

resource_id's default value

Source
resource_id_present?
resource_id_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_id_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_id_will_change!

Include resource_id in the set of changed attributes, whether it has changed or not.

resource_type

resource_type getter

resource_type=(value : String)

resource_type setter

resource_type?

NOTE: use getter / getter! (not property / property!) so that the setter defined later in __create_initializer__ is the only setter on the field. Crystal's overload resolution silently fails to replace a property-defined setter with one of identical signature for generic types (e.g. Set(String)?, Array(String)?, String | Array(String)), although it does work for non-generic ones like String?. Defining the setter only once via __create_initializer__ ensures change tracking, sanitization, and custom setter blocks run uniformly across all types.

resource_type_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_type_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

resource_type_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_type_default

resource_type's default value

Source
resource_type_present?
resource_type_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_type_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

resource_type_will_change!

Include resource_type in the set of changed attributes, whether it has changed or not.

restore_attributes

Reset each attribute to their previous values and clears all changes.

snapshot

snapshot getter

snapshot=(value : JSON::Any | Nil)

snapshot setter

snapshot_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

snapshot_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

snapshot_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

snapshot_default

snapshot's default value

Source
snapshot_present?

the full record, for deletes (see History::Tracked.undelete) and approvals. NOTE:: pg-orm reads a NULL column as JSON::Any(nil)

snapshot_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

snapshot_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

snapshot_will_change!

Include snapshot in the set of changed attributes, whether it has changed or not.

table_name

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_email

user_email getter

user_email=(value : String | Nil)

user_email setter

user_email_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_email_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

user_email_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_email_default

user_email's default value

Source
user_email_present?
user_email_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_email_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_email_will_change!

Include user_email in the set of changed attributes, whether it has changed or not.

user_id

user_id getter

user_id=(value : String | Nil)

user_id setter

user_id_assigned?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

user_id_changed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_id_default

user_id's default value

Source
user_id_present?
user_id_removed?

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_id_was

Unified change history for models that include History::Tracked.

Entries are written in the same transaction as the change they describe. Filter by resource_type (the table name) and resource_id, or by correlation_id to see changes recorded against a parent, e.g. every permission change of a group.

user_id_will_change!

Include user_id in the set of changed attributes, whether it has changed or not.

validate_nilability

Validate that all non-nillable fields have values.

Nested types