File download using Paperclip

前端 未结 2 977
被撕碎了的回忆
被撕碎了的回忆 2021-02-07 05:37

I am using Rails to make a small file upload app. For file attachment I am using the wonderful Paperclip but I can\'t work out how to do downloads.

How would I create a

相关标签:
2条回答
  • 2021-02-07 05:53

    Replace whatever by name that are user in your model for paper clip if you have

    resource_file_name, resource_file_name, resource_file_name,

    then replace whatever by resource

    0 讨论(0)
  • 2021-02-07 06:08

    If the file uploaded is attached to a model, e.g. as an attribute called avatar, then you can create a link like:

    <%= link_to "Download", model.avatar.url(:original, false) %>
    

    Replace avatar with the name of your attribute.

    0 讨论(0)
提交回复
热议问题