How to Create Download Link

前端 未结 3 1584
粉色の甜心
粉色の甜心 2021-02-06 01:13

What\'s the best way to create a download link? Is there a better way than the following?

I was thinking of using link_to \"Download\", :controller => ..., :act

3条回答
  •  时光说笑
    2021-02-06 01:31

    You could just have your download logic in your show action and give it:

    <%= link_to "Download", document_path(document) %>
    

    I'm pretty sure that the :controller / :action / :id method of linking is frowned upon.

提交回复
热议问题