title: Rails Exporting to CSV without constructing CSV in memory
body: <p>Rails 2.3.5, Ruby 1.8.7.</p>
  
  <p>In a <a href="https://stackoverflow.com/questions/94502/in-rails-how-to-return-records-as-a-csv-file">prior question</a>, there are a number of solutions to exporting data in CSV format, but some of them seem to construct the data in memory before sending.  Is this wise when exporting large data sets? Do any of the solutions in the prior question avoid this.</p>
  
  <p>Or is it impossible to avoid building a response without building the whole response locally, either in memory or in a temp file?</p>
  
  <p>I would not be surprised if the latter was true, since if there is an error in the CSV generation, you might want to send an error message back instead, but I might be generating way too much data to want to generate the data in memory/on disk.</p>