3

現在のビューとは異なるディレクトリ (私の場合は親) にあるパーシャルをレンダリングするにはどうすればよいですか?

<%=render_partial :sidebar%> #looks in the current dir and works as expected
<%=render_partial "/view/sidebar"%> #doesn't work!

ありがとう!

4

3 に答える 3

-1

apidock.com で次の API を見つけました。

 # Renders a collection of partials located in a view subfolder
 # outside of our current controller.  In this example we will be
 # rendering app/views/shared/_note.r(html|xml)  Inside the partial
 # each element of @new_notes is available as the local var "note".
 render :partial => "shared/note", :collection => @new_notes
于 2012-12-07T02:03:41.450 に答える