I am displaying an image in view using <%= image_tag(@staff.attachment_url(@staff.image), alt: "No image", width: "100px", height: "100px") %>
which is working fine.
Here attachment_url
is method for creating dynamic url every time you open the image i.e. staff_profiles/images/b64f8b457dddf968712401bf07a8d08ba7f1ce3a326598ec2144f1c995309e06
and also this image is valid for 30 second only and after 30 second when you refresh or open the same url it will show Access denied
.
Everything here is working fine.
Like this image i have other attachments to download/view with download link. when any user open page this attachment_url calls at the time of page load / show method but after 30 seconds this download link expires and when user click on the link it shows Access Denied
. I want to call the attachment_url
when user click on download link after 1 minute or 5 minutes or 10 minutes of page load.
So I need to open the image or create download link url from controller, Not like mentioned above and also want to use the method given above attachment_url
which will help to create url dynamic.
Thanks
Aucun commentaire:
Enregistrer un commentaire