5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 20:46:22 +00:00
panel/app/models/concerns/usuarie/consent.rb

27 lines
608 B
Ruby
Raw Permalink Normal View History

2023-03-28 21:21:55 +00:00
# frozen_string_literal: true
class Usuarie
# Gestiona los campos de consentimiento
module Consent
extend ActiveSupport::Concern
included do
CONSENT_FIELDS = %i[privacy_policy_accepted terms_of_service_accepted code_of_conduct_accepted available_for_feedback_accepted]
CONSENT_FIELDS.each do |field|
attribute field, :boolean
2023-03-28 21:21:55 +00:00
end
before_save :update_consent_fields!
private
def update_consent_fields!
CONSENT_FIELDS.each do |field|
send(:"#{field}_at=", Time.now) if send(field).present?
2023-03-28 21:21:55 +00:00
end
end
end
end
end