Redirect to active_storage files when available
This commit is contained in:
parent
079ffadfce
commit
32563c3675
2 changed files with 10 additions and 2 deletions
|
@ -14,7 +14,11 @@ module Instructeurs
|
|||
after_action :mark_annotations_privees_as_read, only: [:annotations_privees, :update_annotations]
|
||||
|
||||
def attestation
|
||||
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
||||
if 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
|
||||
|
||||
def apercu_attestation
|
||||
|
|
|
@ -48,7 +48,11 @@ module Users
|
|||
end
|
||||
|
||||
def attestation
|
||||
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
||||
if 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
|
||||
|
||||
def identite
|
||||
|
|
Loading…
Reference in a new issue