Sending a file to a user

Hello,

In my application I would like the user to download a file that is dynamically created from the database. Currently, I have rails put all the text into one variable and then save that to a temporary file with a filename that is generated from a sha1.

If a user requests a file, is there a way to automatically delete that temporary file when it is done downloading or should I just set up a cron job?

Or, if you have any other suggestion on how to send a file to a user there would be greatly appreciated.

Thanks, Mike

No need to save your data in a file. Just use send_data [1].

Christian

[1] http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000624