I've been trying to get a dynamic nested form working with ajax in rails 3.
Originally I was following this example project and one of the helpers (add_task_link) looks really good, except that I can't seem to render a partial into a variable. I know that in a controller I can render_to_string, but not from a helper. It looks like in previous versions of rails it must have worked by just assigning the render call to a variable, but not any more.
Is there a workaround for this? I'm sure it must still be possible.
Thanks
Use the capture method:
<% snippet = capture do %>
<%= render :partial => 'some partial' %>
<% end %>
Later you can use the variable like this:
<%= snippet %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With