5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-18 13:46:21 +00:00

fixup! feat: almacenar los campos

This commit is contained in:
f 2023-03-28 18:21:55 -03:00
parent 33859946c2
commit 1fc4797c4f

View file

@ -0,0 +1,26 @@
# 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|
attr_accessor field
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?
end
end
end
end
end