Forum: Ruby on Rails Streaming from controller

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
white@ (Guest)
on 2009-05-14 11:42
(Received via mailing list)
Hi people,

I need to stream a lot of data from the controller (no need for a
view). It generates on the go, and can take pretty long time to
complete.  I'm not sure it effective to generate a string (the output
can be hundreds of megs) and pass it to the view.

However, the only way I found is to use render :text => ... which also
can be called only once in controller, so not a real on the go

Neither store to file and then streaming it with render :file works.
Several simultaneous uses of the controller can generate pretty huge
files for every instance, which is no-go.  Anyway, it's not on the go
as well.

The other way is render :text = { |r,o| ... }, however,
somehow it doesn't seem to be working for my case.  First of all, it
complains about some random each ... do blocks (which work just fine
when the blocks are not passed to   When I'm commenting
them out, I'm getting things like that:

Wed May 13 17:34:39 -0700 2009: Read error: #<ArgumentError: A copy of
DoController has been removed from the module tree but is still active!
dependencies.rb:414:in `load_missing_constant'
dependencies.rb:96:in `const_missing'
response.rb:153:in `call'
response.rb:153:in `each'
vendor/rack-1.0/rack/chunked.rb:37:in `each'
vendor/rack-1.0/rack/handler/mongrel.rb:74:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
vendor/rack-1.0/rack/handler/mongrel.rb:34:in `run'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'

I think the similar situation is also mentioned here

So, I'd very appreciate any hint how I can solve this problem.  Thank
This topic is locked and can not be replied to.