2015-08-10 11:05:06 +02:00
|
|
|
class Dossier < ActiveRecord::Base
|
|
|
|
has_one :etablissement
|
|
|
|
has_one :entreprise
|
2015-08-13 15:55:19 +02:00
|
|
|
has_many :pieces_jointes
|
2015-08-14 14:05:09 +02:00
|
|
|
belongs_to :formulaire
|
2015-08-10 11:05:06 +02:00
|
|
|
has_many :commentaires
|
2015-08-12 10:09:52 +02:00
|
|
|
|
2015-08-13 15:55:19 +02:00
|
|
|
delegate :siren, to: :entreprise
|
|
|
|
delegate :siret, to: :etablissement
|
2015-08-14 15:02:11 +02:00
|
|
|
delegate :types_piece_jointe, to: :formulaire
|
2015-08-13 15:55:19 +02:00
|
|
|
|
2015-08-12 10:09:52 +02:00
|
|
|
def get_pj piece_jointe_id
|
2015-08-14 12:06:26 +02:00
|
|
|
pieces_jointes.where(type_piece_jointe_id: piece_jointe_id).last
|
|
|
|
end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|