Force Downloading of File in Shrine 3

Usually we get link to file like this:

irb(main):001:0> Document.last.asset.url

=> ""

But in this case, this file will be opened in browser.

If you want to force download file you should add response_content_disposition and make private link (if it’s not true):

irb(main):002:0> Document.last.asset.url(public: false, response_content_disposition: "attachment")

=> ""

Do you have a project for us?Get a free quote