recipe for downloading files
04 Nov 2010, 21:03
Csaba Nemeth (5 posts)
Is there a recipe for downloading files in Rails? I’m kind of new to Rails (and Ruby) and not finding much help on this subject on the net.
In my app, I have a page with a list of files (mostly pdf but there are other types like doc, xls, etc.). The list of files is generated by a statement in the controller index method by reading the content of a specific directory (no model):
In the @index.html.erb@, a loop lists the files. Next to each filename, I want to have a download link, such that, when the user clicks it, it invokes the @download@ method in the controller:
So far, I haven’t been successful implementing this scheme so any help or pointers would be greatly appreciated.
|You must be logged in to comment|