Class: Clickwrap::LegalHold
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Clickwrap::LegalHold
- Defined in:
- lib/clickwrap/models/legal_hold.rb
Overview
A legal hold pauses scheduled disposition for an event, an actor, or a policy.
It requires a reason, an owner, and a review date. That is not bureaucracy:
an indefinite hold with no owner is exactly how "we'll delete it later"
becomes "we kept everything forever", and a retention policy that can be
suspended invisibly is not a retention policy. Placement and release append
linked lifecycle events; this row is the current operational projection and
changes only through the named release! transition.
Constant Summary collapse
- SCOPES =
%w[event actor policy].freeze
Instance Method Summary collapse
- #in_effect? ⇒ Boolean
- #release!(because:, released_by:) ⇒ Object
- #released? ⇒ Boolean
- #to_s ⇒ Object
Instance Method Details
#in_effect? ⇒ Boolean
34 |
# File 'lib/clickwrap/models/legal_hold.rb', line 34 def in_effect? = !released? |
#release!(because:, released_by:) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/clickwrap/models/legal_hold.rb', line 36 def release!(because:, released_by:) raise LegalHoldInEffect, "Releasing a legal hold needs a `because:` explaining why." if because.to_s.strip.empty? raise LegalHoldInEffect, "Legal hold #{id} was already released at #{released_at}." if released? update_columns( released_at: Clickwrap.now, released_by_reference: Reference.actor(released_by), release_reason: because ) self end |
#released? ⇒ Boolean
33 |
# File 'lib/clickwrap/models/legal_hold.rb', line 33 def released? = released_at.present? |
#to_s ⇒ Object
48 |
# File 'lib/clickwrap/models/legal_hold.rb', line 48 def to_s = "legal hold on #{hold_scope} (#{reason})" |