search for: howtoexportdataascsv

Displaying 2 results from an estimated 2 matches for "howtoexportdataascsv".

2006 Dec 11
4
Holding an ActiveRecord object for later use.
...uestion.. I have a fairly large query (the result takes along time to return) that I need to export to CSV after it is displayed with a view. Basically a link at the bottom of the page, "Export to CSV". I''ve found the rails wiki solution: http://wiki.rubyonrails.com/rails/pages/HowtoExportDataAsCSV . The only problem is that I would like to have this in it''s own controller and I''m wondering how I should keep a handle on the ActiveRecord object that has already been created from the query, I would also like to keep this as DRY as possible and not have to regenerate the query....
2007 Feb 28
8
Export/save csv-file to desktop of user?
Hi, looking for something that simple, but can''t find it. I got: outfile = File.open(''teams.txt'', ''wb'') CSV::Writer.generate(outfile) do |csv| for team in @teams csv << [team.id, team.name] end end outfile.close send_file "teams.txt", :filename => "teams.txt",:disposition =>