First time using rails, I’m trying to create a download link to get something off the file system.
In my view, I’ve got
<%= link_to 'Show', upload, :method => :download %>
and my ‘download’ method in my controller looks like:
def download
@upload = Upload.find(params[:id])
send_file '/data_store/50692.pdf'
This is needed because I have restrictions on who can view this pdf, but on this page, I get linked to
http://localhost:3000/uploads/10
(10 is the id of this ‘upload’)
and on that page, I get the error
Unknown action
No action responded to 10. Actions: clearance, create, destroy, download, edit, index, is_admin, new, show, su_required, and update
I want it instead to stay on the same page, and offer the user a download prompt, but I’m not sure what I’m doing wrong.
I think it is a problem in the calling download method.
Try this one
You must pass your controller name in the place “controllername”.