2009
12.18

Some times, it might be necessary to save a partial content into an instance variable and use it later while rendering the whole page.

For those cases, use “render_to_string”,  which takes partial as a parameter (and many others too).

Eg: @partial_string = render_to_string :partial=>”some/partial”

render_to_string renders according to the same rules as render , but returns the result in a string instead of sending it as the response body to the browser.

Hope this helps. :-)

No Comment.

Add Your Comment