Reputation: 5810
I need to send some html code to another site via API on my rails 2.3 application. The html code is rendered by another action. Is there a good way for a controller to get the rendered view html code?
One way I can think of is that action A calls action B via HTTP and get the result. However, I think this is a waste of resources. Is there a better way?
Thanks.
Sam
Upvotes: 1
Views: 51
Reputation: 49104
I think you want render_to_string which will send the output of the render to a string, instead of back to the client. Use it in your format.js response block.
See api doc
Upvotes: 2
Reputation: 15965
respond_to do |format|
format.js { render(:partial => 'some_thing.html.erb', :layout => false) }
end
Upvotes: 0