Rails render partial with block

前端 未结 5 1909
灰色年华
灰色年华 2020-12-04 06:35

I\'m trying to re-use an html component that i\'ve written that provides panel styling. Something like:

  
5条回答
  •  有刺的猬
    2020-12-04 06:53

    I think it will work (just did quick dirty test) if you assign it to a variable first and then output it.

    <% foo = render :partial => '/shared/panel', :locals =>{:title => "Some Title"} do %>
    

    Here is some content to be rendered inside the panel

    <% end %> <%= foo %>

提交回复
热议问题