demarches-normaliennes/app/models/dossier.rb
Tanguy PATTE 107b11d510 rename ref_demarche into demarche_id
fix association between formulaire and type_piece_jointe
fix association between formulaire and evenement_vie
2015-08-14 15:02:11 +02:00

17 lines
392 B
Ruby

class Dossier < ActiveRecord::Base
has_one :etablissement
has_one :entreprise
has_many :pieces_jointes
belongs_to :formulaire
has_many :commentaires
delegate :siren, to: :entreprise
delegate :siret, to: :etablissement
delegate :types_piece_jointe, to: :formulaire
def get_pj piece_jointe_id
pieces_jointes.where(type_piece_jointe_id: piece_jointe_id).last
end
end