我使用回形针创建了文件上传!文件按预期上传。比我添加的文件下载方法是这样的:
def download
sample = Sample.find(params[:id])
send_file upload.sample.path,
:filename => upload.sample_file_name,
:type => upload.sample_content_type,
:disposition => 'attachment'
flash[:notice] = "Your file has been downloaded"
end
但我不知道,我应该在我的表演动作中放什么,这样我才能下载文件?
我做到了这一点:
<td><%= @sample.upload_file_name =%></td>
<%= link_to 'Download', :action => :download, :path =>@sample.upload.url, :type => @sample.upload_content_type %>
但它显示错误:找不到带有 id=download 的示例
谁能帮我?