A question on Active Storage
: I just updated to rails 5.2 and I am trying to open the attached document which is saved as a blob
. Currently, it's redirecting to root_path
, any idea how can I open/download it instead?
My code in Rails view is:
<%= link_to(document.filename, rails_blob_path(document, disposition: "attachment")) %>
To Download:
<%= link_to document.filename, rails_blob_path(document, disposition: 'attachment') %>
To Preview:
<%= link_to document.filename, rails_blob_path(document, disposition: 'preview') %>
Source - ActiveStorage#Linking to Files documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With