diff --git a/app/models/champs/piece_justificative_champ.rb b/app/models/champs/piece_justificative_champ.rb index 208aca715..7e7e897b6 100644 --- a/app/models/champs/piece_justificative_champ.rb +++ b/app/models/champs/piece_justificative_champ.rb @@ -49,7 +49,9 @@ class Champs::PieceJustificativeChamp < Champ end def for_api - Rails.application.routes.url_helpers.url_for(piece_justificative_file) + if piece_justificative_file.attached? + Rails.application.routes.url_helpers.url_for(piece_justificative_file) + end end private