markhorrocks
markhorrocks

Reputation: 1408

Rails 3.2 zip multiple text files

I need to write about 10 text files from query results then zip and send them.

Is there a way to do this all in memory or do I need to write the files to /tmp or database first? What is best practise for a Rails 3.2.11 application?

I don't need any functionality beyond creating the files, zipping and sending them in a single action. The files are not large.

Upvotes: 0

Views: 226

Answers (1)

MrTheWalrus
MrTheWalrus

Reputation: 9700

You will need to create some temporary files. Where you chose to put them is up to, you, however.

Here's a blog post (not mine, and not tested, but I see no reason the process described shouldn't work) that describes using Rails to zip some files and send the resulting archive to the user. It shouldn't be too hard to adapt it for your needs.

Upvotes: 2

Related Questions