Leventix
Leventix

Reputation: 3859

Rendering multiple partials in a controller

I want to render multiple partials in a controller, these will not be part of the response, but pushed to clients via Juggernaut instead.

I'm using render_to_string.

When the second one is called, I get a DoubleRenderError.

How do I render a partial the way that performed? will not be affected?

Upvotes: 6

Views: 3002

Answers (2)

taelor
taelor

Reputation: 639

wait so how can you do this in a after_filter hook? cause im running into the same issue, and have to do an after_filter hook.

btw, im in a similar situation using push tech, but with HTML 5 websockets, and eventmachine

Upvotes: 1

Leventix
Leventix

Reputation: 3859

It turns out render_to_string clears off "render results", so you can call it multiple times. The problem was that I called render_to_string in an after_filter hook, after a render was already called.

Upvotes: 4

Related Questions