Search code examples
ruby-on-rails-3.1hamlhttp-streaming

Rails HTTP streaming with HAML


There appears to be an issue with using HTTP streaming with HAML projects in rails. It works perfectly if I use ERB instead. Apparently, I'm not the only one with this problem.

It doesn't work with placing stream at the top of the controller, or with using render :stream => true in the action.

How can I get HAML and HTTP streaming to play nicely together?

Update: I've opened an issue on the gem's page, here.


Solution

  • This is not yet supported by HAML (source):

    HTTP streaming is the sort of thing that would require a substantial set of modifications to the core Haml engine. It's only moderately tricky to get it working even in basic cases, but when you factor in things like the whitespace-eating operators it gets much more difficult.

    This isn't something I'm opposed to in theory, but it's also not something that's high on my priority list given the difficulty of implementing it.