Guard for missing attestation on dossier

This commit is contained in:
Paul Chavard 2019-11-05 16:44:28 +01:00
parent 95f98fe605
commit f5c80f211d

View file

@ -48,8 +48,11 @@ module Users
end
def attestation
if dossier.attestation.pdf.attached?
if dossier.attestation&.pdf&.attached?
redirect_to url_for(dossier.attestation.pdf)
else
flash.notice = "L'attestation n'est plus disponible sur ce dossier."
redirect_to dossier_path(dossier)
end
end