So I'd like to stream my response body to the client.
At least under Rails2, it looks like you can pass a Proc to render
:text, to do that.
I am in a Rails2 app right now, but will upgrade to Rails3 sometime in
the next couple months, so don't want to set myself up for failure.
Anyone know the status of streaming responses in Rails3? Is it
possible? Is there a different API to do so? (Seems like using Rack
api, it definitely must be possible, since Rails3 is all rack, and rack
is fine with iteratively-delivered responses, but it's not entirely
clear to me how to do it).
On top of that, even in Rails2, I'm having an awful lot of trouble
setting custom headers in the response using the render :text => proc
pattern. The proc, according to what limited docs I've found, takes
two args, the first one is a 'response', which I should be able to set
headers on, but I can't seem to make them stick.
Can anyone give me the lowdown on streaming responses in Rails? Maybe
a good example, even one that sets headers too?