Streaming from controller

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' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ dependencies.rb:96:inconst_missing’
preparesql' /Users/white/repo/vurvimport/app/controllers/do_controller.rb:630:inrendersql’
response.rb:153:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ response.rb:153:ineach’
vendor/rack-1.0/rack/chunked.rb:37:in each' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ vendor/rack-1.0/rack/handler/mongrel.rb:74:inprocess’
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:ineach’
process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun’
initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:innew’
/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:ininitialize’
/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:inrun’
vendor/rack-1.0/rack/handler/mongrel.rb:34:in run' /Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:111 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require’
/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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs