demarches-normaliennes/app/models/dossier.rb
Tanguy PATTE 3c57643f76 add database cleaner
add factory girl
fix tests
rename dossier_pdf into piece_jointe
rename ref_piece_jointe into content
2015-08-13 15:56:58 +02:00

14 lines
347 B
Ruby

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