From 31c45fe2e551b056ef7cadf5b7f6f333141154bc Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 10 Jan 2019 15:18:54 +0100 Subject: [PATCH] Fix Sentry 161 --- app/models/champs/piece_justificative_champ.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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