Redirect to pdf attachement old name if not attached

This commit is contained in:
Paul Chavard 2019-09-10 11:09:51 +02:00
parent 0201a501c6
commit 347f03d2a9
6 changed files with 23 additions and 32 deletions

View file

@ -14,10 +14,10 @@ module Instructeurs
after_action :mark_annotations_privees_as_read, only: [:annotations_privees, :update_annotations]
def attestation
if dossier.attestation.pdf_active_storage.attached?
if dossier.attestation.pdf.attached?
redirect_to url_for(dossier.attestation.pdf)
elsif dossier.attestation.pdf_active_storage.attached?
redirect_to url_for(dossier.attestation.pdf_active_storage)
else
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
end
end