create piece jointe when formulaire is linked to dossier

This commit is contained in:
Tanguy PATTE 2015-08-24 15:23:07 +02:00
parent 327412fba3
commit cee8136ecf
9 changed files with 21 additions and 18 deletions

View file

@ -12,6 +12,8 @@ class Dossier < ActiveRecord::Base
before_create :build_default_cerfa
after_save :build_default_pieces_jointes, if: Proc.new { formulaire_id_changed? }
validates :mail_contact, format: { with: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/ }, unless: 'mail_contact.nil?'
def retrieve_piece_jointe_by_type(type)