feat(commune): display departement information on commune champ

This commit is contained in:
Paul Chavard 2021-11-30 19:39:25 +01:00
parent ed2cbdc966
commit fcbe364ac8
3 changed files with 32 additions and 4 deletions

View file

@ -25,4 +25,25 @@ class Champs::CommuneChamp < Champs::TextChamp
def for_export
[value, external_id]
end
def name_departement
#FIXME we originaly saved already formatted departement with the code in the name
departement&.gsub(/^(.[0-9])\s-\s/, '')
end
def departement_code_and_name
"#{code_departement} - #{name_departement}"
end
def departement?
departement.present?
end
def code?
code.present?
end
def code
external_id
end
end