demarches-normaliennes/app/models/etablissement.rb

18 lines
489 B
Ruby
Raw Normal View History

2015-08-10 11:05:06 +02:00
class Etablissement < ActiveRecord::Base
belongs_to :dossier
belongs_to :entreprise
has_many :exercices, dependent: :destroy
validates_uniqueness_of :dossier_id
def geo_adresse
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
end
2017-06-22 14:58:29 +02:00
def inline_adresse
#squeeze needed because of space in excess in the data
"#{numero_voie} #{type_voie} #{nom_voie}, #{complement_adresse}, #{code_postal} #{localite}".squeeze(' ')
end
2015-08-10 11:05:06 +02:00
end