diff --git a/app/models/champ.rb b/app/models/champ.rb index 1b78f2a27..f396e988c 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -19,10 +19,6 @@ class Champ < ApplicationRecord mandatory? && value.blank? end - def self.pays - JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom") - end - def to_s if value.present? string_value diff --git a/app/models/champs/pays_champ.rb b/app/models/champs/pays_champ.rb index 95b89893f..f8204f4d0 100644 --- a/app/models/champs/pays_champ.rb +++ b/app/models/champs/pays_champ.rb @@ -1,2 +1,5 @@ class Champs::PaysChamp < Champs::TextChamp + def self.pays + JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom") + end end diff --git a/app/views/shared/dossiers/editable_champs/_pays.html.haml b/app/views/shared/dossiers/editable_champs/_pays.html.haml index cdc2e489d..aba08f38a 100644 --- a/app/views/shared/dossiers/editable_champs/_pays.html.haml +++ b/app/views/shared/dossiers/editable_champs/_pays.html.haml @@ -1,3 +1,3 @@ = form.select :value, - Champ.pays, + Champs::PaysChamp.pays, required: champ.mandatory? diff --git a/app/views/users/description/champs/_pays.html.haml b/app/views/users/description/champs/_pays.html.haml index 2f530b683..67981205c 100644 --- a/app/views/users/description/champs/_pays.html.haml +++ b/app/views/users/description/champs/_pays.html.haml @@ -1,2 +1,2 @@ = select_tag("champs['#{champ.id}']", - options_for_select(Champ.pays, selected: champ.object.value)) + options_for_select(Champs::PaysChamp.pays, selected: champ.object.value))