I need to export some data into a text file. I have searched a little and I can’t seem to find anything useful and recent. I’m already using pdfkit and csv to export data to pdf and csv files, so I don’t know if I can use any of these to make the text. Anyone had this problem and found a solution recently?
EDIT
My question is a little vague, I’ll specify more. I need to do something like CSV.generate does. Add rows for every value of the attribute in the register. I find the register, I store it in a variable, and then I need to “add” every value as a row in the textfile. The part of make a loop through the attributes of the register found I got it working, what I don’t know is how to copy it. That’s the part where I’m stuck.
EDIT 2
I ended up passing an array of all the attributes of the register and saving it in a local variable, then I did what you suggested and it works perfectly.
Quick search:
http://railsforum.com/viewtopic.php?id=37888
see also http://api.rubyonrails.org/classes/ActionController/Streaming.html