From 1fc4797c4f3f8e8e0b1751f55ca7e8f312777ce6 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 18:21:55 -0300 Subject: [PATCH 1/3] fixup! feat: almacenar los campos --- app/models/concerns/usuarie/consent.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/models/concerns/usuarie/consent.rb diff --git a/app/models/concerns/usuarie/consent.rb b/app/models/concerns/usuarie/consent.rb new file mode 100644 index 00000000..6d9b5051 --- /dev/null +++ b/app/models/concerns/usuarie/consent.rb @@ -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 From d2136380d5e678439de216e08122660500b3062f Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 18:28:31 -0300 Subject: [PATCH 2/3] fixup! fixup! feat: almacenar los campos --- app/models/concerns/usuarie/consent.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/usuarie/consent.rb b/app/models/concerns/usuarie/consent.rb index 6d9b5051..14e67fbc 100644 --- a/app/models/concerns/usuarie/consent.rb +++ b/app/models/concerns/usuarie/consent.rb @@ -9,7 +9,7 @@ class Usuarie 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 + attribute field, :boolean end before_save :update_consent_fields! @@ -18,7 +18,7 @@ class Usuarie def update_consent_fields! CONSENT_FIELDS.each do |field| - send(:"#{field}_at=", Time.now) if send(:field).present? + send(:"#{field}_at=", Time.now) if send(field).present? end end end From 7091d79ff92f2bb57affdf57ea6a6c536702bae4 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 18:33:19 -0300 Subject: [PATCH 3/3] =?UTF-8?q?BREAKING=20CHANGE:=20eliminar=20campo=20que?= =?UTF-8?q?=20no=20se=20us=C3=B3=20nunca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...remove_acepta_politicas_de_privacidad_from_usuaries.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb diff --git a/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb b/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb new file mode 100644 index 00000000..7ca562bf --- /dev/null +++ b/db/migrate/20230328213242_remove_acepta_politicas_de_privacidad_from_usuaries.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Elimina un campo que nunca se usó +class RemoveAceptaPoliticasDePrivacidadFromUsuaries < ActiveRecord::Migration[6.1] + def change + remove_column :usuaries, :acepta_politicas_de_privacidad, :boolean, default: false + end +end