ユーザーのプロファイルに広告pdfやtxtなどのドキュメントをアップロードする必要があります。そして、Carrierwaveを使用してそれを行ったので、タイトルとURLを含むドキュメントのリストがあります。
しかし、どうすれば他のユーザーにそれらのファイルをダウンロードさせることができますか?宝石を使用する必要がありますか、それとも私はレールに非常に慣れていないので、私が知らないネイティブなものがありますか?
ありがとう
編集:
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 %>