validation is enableed only for 'new' procedures

This commit is contained in:
clemkeirua 2020-07-15 16:06:24 +02:00 committed by Keirua (Rebase PR Action)
parent 0d88674cea
commit 31d48c2879
3 changed files with 35 additions and 12 deletions

View file

@ -35,9 +35,8 @@ class Champs::PieceJustificativeChamp < Champ
validates :piece_justificative_file,
content_type: ACCEPTED_FORMATS,
size: { less_than: MAX_SIZE }
before_save :update_skip_pj_validation
size: { less_than: MAX_SIZE },
if: -> { !type_de_champ.skip_pj_validation }
def main_value_name
:piece_justificative_file
@ -60,8 +59,4 @@ class Champs::PieceJustificativeChamp < Champ
piece_justificative_file.service_url
end
end
def update_skip_pj_validation
type_de_champ.update(skip_pj_validation: true)
end
end