我需要我的用户上传他们的个人资料上的文档,如广告pdf和txt。我使用Carrierwave做到了这一点,所以我有一份包含标题和网址的文档列表。Rails:如何下载以前上传的文档?
但我怎样才能让其他用户下载这些文件?我是否必须使用宝石,或者是否有本地的我不知道,因为我是非常新的轨道?
感谢
编辑:
society.rb
class Society < ActiveRecord::Base
...
has_many :documents, :dependent => :destroy
end
document.rb
class Document < ActiveRecord::Base
belongs_to :society
mount_uploader :url, DocumentUploader
end
然后在此我要下载文件的视图:
<% @society.documents.each do |doc| %>
<%= link_to "Download it", doc.url %> //url is the column name of the saved url
<% end %>
也许愚蠢的问题:如何处理您提到的网址给其他用户? – Romain 2012-07-27 14:54:37
对不起,我不明白你的意思=) – Barbared 2012-07-27 15:01:43
请参阅@ anthonyalberto的回答。 – Romain 2012-07-27 15:04:00