5
Rails使用块渲染部分
我试图重新使用我编写的提供面板样式的html组件。就像是: <div class="v-panel"> <div class="v-panel-tr"></div> <h3>Some Title</h3> <div class="v-panel-c"> .. content goes here </div> <div class="v-panel-b"><div class="v-panel-br"></div><div class="v-panel-bl"></div></div> </div> 因此,我看到渲染占用了一个块。我想然后我可以做这样的事情: # /shared/_panel.html.erb <div class="v-panel"> <div class="v-panel-tr"></div> <h3><%= title %></h3> <div class="v-panel-c"> <%= yield %> </div> <div class="v-panel-b"><div class="v-panel-br"></div><div class="v-panel-bl"></div></div> </div> 我想做类似的事情: #some html view <%= render :partial => '/shared/panel', :locals …