Ruby on Rails 3: Streaming data through Rails to client
Assign to response_body an object that responds to #each: class Streamer def each 10_000_000.times do |i| yield “This is line #{i}\n” end end end self.response_body = Streamer.new If you are using 1.9.x or the Backports gem, you can write this more compactly using Enumerator.new: self.response_body = Enumerator.new do |y| 10_000_000.times do |i| y << “This … Read more