2024-03-18 16:32:57 +01:00
|
|
|
module DomainMigratableConcern
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
enum preferred_domain: { demarches_gouv_fr: 0, demarches_simplifiees_fr: 1 }, _prefix: true
|
|
|
|
|
|
|
|
validates :preferred_domain, inclusion: { in: User.preferred_domains.keys, allow_nil: true }
|
2024-03-18 19:31:57 +01:00
|
|
|
|
|
|
|
def update_preferred_domain(host)
|
2024-04-05 15:15:40 +02:00
|
|
|
# DIRTY FIX
|
|
|
|
#
|
|
|
|
# case host
|
|
|
|
# when ApplicationHelper::APP_HOST
|
|
|
|
# preferred_domain_demarches_gouv_fr!
|
|
|
|
# when ApplicationHelper::APP_HOST_LEGACY
|
|
|
|
# preferred_domain_demarches_simplifiees_fr!
|
|
|
|
# end
|
2024-03-18 19:31:57 +01:00
|
|
|
end
|
2024-03-18 16:32:57 +01:00
|
|
|
end
|
|
|
|
end
|