title: Rails streaming: "render stream: true" not working
body: <p>I recently discovered rails streaming, and having read the various documentation, I tried to add it to one of my controllers like so:</p>
  
  <pre><code>def index
      render :stream =&gt; true
  end
  </code></pre>
  
  <p>My template file currently looks like this:</p>
  
  <pre><code>&lt;%10.times do%&gt;
    &lt;p&gt;
      I should get streamed ERB...
      &lt;%sleep 0.5%&gt;
    &lt;/p&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>But instead of displaying a message every 0.5 seconds, it waits 5 seconds and displays the whole page! I have checked this behavior in a browser and using curl.</p>
  
  <p>I am using unicorn on OSX, and yes, I configured unicorn.rb for streaming:</p>
  
  <pre><code>listen 3000, :tcp_nodelay =&gt; true, :tcp_nopush =&gt; false
  worker_processes 1
  </code></pre>
  
  <p>If you want to see my layout file, it looks like this:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;StreamingTest&lt;/title&gt;
    &lt;%= stylesheet_link_tag    "application" %&gt;
    &lt;%= javascript_include_tag "application" %&gt;
    &lt;%= csrf_meta_tags %&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;%= yield %&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I tried disabling all gems (except rails and postgres), and I pared my controller, layout, and template down to the bare minimum, without any success.</p>
  
  <p>I even went so far as to download a complete streaming demo I found (<a href="https://github.com/slim-template/slim-streamingtest" rel="nofollow noreferrer">https://github.com/slim-template/slim-streamingtest</a>), and when I ran that, it didn't stream either! (Note to anybody trying to run that demo: I had to change the gemfile source to use https instead of http before I could "bundle install", and I had to "bundle update sprockets" before it would run)</p>
  
  <p>I note that somebody else (using Puma) appears to have a similar problem, which has not been successfully resolved:</p>
  
  <p><a href="https://stackoverflow.com/questions/23259163/rails-streaming-not-streaming">Rails Streaming not Streaming</a></p>
  
  <p>It may be that whatever works for me will also work for them.</p>
  
  <p>Streaming would really help our app, if I could just get it to work, but I can't even get <em>demo</em> streaming apps to run correctly! I suspect it might have something to do with my dev environment, but the problem remains when I deploy my app to Heroku, and I'm out of ideas. Any help would be greatly appreciated . . . </p>
  
  <p>Thanks!</p>