module

PlaceOS::Model::GroupHistory::Mixin

Mixin that injects the GroupHistory recording machinery into a model.

Including class must provide three small hook methods that tell the mixin what to write:

protected def group_history_resource_type : String # e.g. "group" protected def group_history_resource_id : String # e.g. self.id.to_s protected def group_history_group_id : UUID? # or nil

Optionally override group_history_changed_fields to strip sensitive attributes (see GroupInvitation).

The mixin installs:

  • three virtual (non-persisted, non-serialised) properties: acting_user, was_new_record?, captured_changed_fields.
  • before_save :capture_history_state — snapshots new_record? and the changed attribute list before they're cleared by the save.
  • after_save :record_history_save — writes a "create" or "update" row iff acting_user is set and (for updates) at least one attribute changed.
  • after_destroy :record_history_destroy — writes a "delete" row iff acting_user is set.

Instance methods

group_history_group_id
Source
group_history_resource_id
Source