Send some text as a csv file?

I have a table on a page, and i want a link to download the table data
as a csv. One way to do this would be to have my model class build a
file, and pass the filename back to the controller, which uses send_file
to send it to the user. But, this seems a bit heavy handed - it's a
small amount of data, which is subject to change, and i don't want a
load of files hanging around if i can help it.

Have a look at send_data.