refactor: commune_champ
This commit is contained in:
parent
c77b66feef
commit
124433b781
1 changed files with 2 additions and 11 deletions
|
@ -57,20 +57,11 @@ class Champs::CommuneChamp < Champs::TextChamp
|
||||||
alias postal_code code_postal
|
alias postal_code code_postal
|
||||||
|
|
||||||
def name
|
def name
|
||||||
if departement? && code?
|
APIGeoService.safely_normalize_city_name(code_departement, code, safe_to_s)
|
||||||
APIGeoService.commune_name(code_departement, code).presence || safe_to_s
|
|
||||||
else
|
|
||||||
safe_to_s
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
if departement? && code_postal? && code?
|
code_postal? ? "#{name} (#{code_postal})" : name
|
||||||
name = APIGeoService.commune_name(code_departement, code)
|
|
||||||
name.present? ? "#{name} (#{code_postal})" : safe_to_s
|
|
||||||
else
|
|
||||||
safe_to_s
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def code
|
def code
|
||||||
|
|
Loading…
Reference in a new issue