best way to generate a text or csv file for user to download

lo there all,

i need to be able to generate a link to a dynamically created text or
csv file when a user hits a link or button ( don't know yet ). But
since the file is going to be generated on the fly, i need an action
to actually create it.

Does anyone have an idea of how the best way to do this would be?

thanks

You’ll probably want to take a look at the send_file method:

http://rails.rubyonrails.org/classes/ActionController/Streaming.html#M000091

James.

Also you might find fastercsv useful:

http://fastercsv.rubyforge.org/

thanks, gents, will check it out.