I can't seem to find a simple and clear answer to this problem anywhere! Everything seems either outdated or incomplete!
I just want the user to be able to click on a link or button and download a file (that is somewhere in the public folder)
I tried this:
#view
<%= link_to "Raw blast output" ,:action => :download, :file_name => "public/data/02_blastout/#{@bl_file}" %>
#controller
def download
send_file "#{RAILS_ROOT}/#{params[:file_name]}"
end
but I get this error:
No route matches {:action=>"download", :file_name=>"public/data/02_blastout/input0.fa_x_Glyma1aaunq.bl", :controller=>"cvits"}
Thanks for the help!!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…