AJAXでムニャムニャやる時にVIEWでレンダリングしたHTMLをコントローラーに返して欲しい場合、render_to_stringというメソッドが使える。
Rails API ドキュメント render_to_string(options = nil, &block)
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.
render_to_string :action => 'someaction', :layout => false
見たいな感じ
0 件のコメント:
コメントを投稿