Module: Clickwrap::HasClickwraps
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/clickwrap/models/concerns/has_clickwraps.rb
Overview
What has_clickwraps mixes into the actor model.
It adds the evidence proxy and the associations, and nothing else. Notably
absent: any dependent: :destroy. Deleting an account must not silently
erase the record of what that person agreed to — that is a retention
decision, and it belongs to the host and its counsel, not to a foreign key.
So the associations nullify the actor link on destroy and leave the stable
pseudonymous actor_reference behind. The evidence remains queryable and
verifiable; what disappears is the pointer to a row that no longer exists.
A host that genuinely wants the evidence gone runs disposition through
Clickwrap::Privacy, which records that it did.
Instance Method Summary collapse
-
#clickwrap_actor_reference ⇒ Object
How this record is referenced in evidence.
-
#clickwraps ⇒ Object
The everyday API:
user.clickwraps.agreed_to?(:terms).
Instance Method Details
#clickwrap_actor_reference ⇒ Object
How this record is referenced in evidence.
Uses GlobalID when the host loads it and a stable class/id string in a
minimal Rails host. Either string remains in the evidence after the row is
gone — which is the situation this reference exists for. Override this
method when the host has its own stable pseudonymous identifier scheme;
identify_actor_with asks for it first, so no initializer change is needed.
51 52 53 |
# File 'lib/clickwrap/models/concerns/has_clickwraps.rb', line 51 def clickwrap_actor_reference Clickwrap::Reference.record(self) end |
#clickwraps ⇒ Object
The everyday API: user.clickwraps.agreed_to?(:terms).
40 41 42 |
# File 'lib/clickwrap/models/concerns/has_clickwraps.rb', line 40 def clickwraps @clickwraps ||= Clickwrap::ActorProxy.new(self) end |