In my Rails 2.1 code (I am skipping 2.2...) used to do something like
this from a reports controller:
render_proc = proc do |response, output|
CSV::Writer.generate(output) do |csv|
csv << [ 'Login', 'Name', 'Email' ]
User.find(:all).each do |user|
csv << [ user.login, user.name, user.email ]
render :layout => false, :text => render_proc
This no longer works because CSV:Writer wants to call <<() and it is
Was this removal intentional?
As a side-note, it looks like other people seem to build the whole CSV
as a string and then ship it at the end. Maybe my strategy results in
the same behaviour under Rails unless I explicitly flush it somehow,
in which case maybe I should just copy what everyone else is doing...