This is similar to this question but with a collection:
<div class="panel-body">
<%= render layout: 'today_items_list', locals: {items: @pos} do |po| %>
<% @output_buffer = ActionView::OutputBuffer.new %>
<%= link_to "##{po.id}", po %>
<%= po.supplier.name %>
<% end %>
</div>
with partial/layout:
.tableless_cell.no_padding
%h3.no_margin_vertical= title
%ul.no_margin_vertical
- for item in items
%li= yield(item)
This renders as you expect but if I omit the weird '@output_buffer = ActionView::OutputBuffer.new', the buffer is not cleared and the list is rendered this way:
<li>
<a href="/purchase_orders/4833">#4833</a>Supplier name
</li>
<li>
<a href="/purchase_orders/4833">#4833</a>Supplier name
<a href="/purchase_orders/4835">#4835</a>Supplier name 2
</li>
<li>
<a href="/purchase_orders/4833">#4833</a>Supplier name
<a href="/purchase_orders/4835">#4835</a>Supplier name 2
<a href="/purchase_orders/4840">#4840</a>Supplier name 3
</li>
Never clearing the buffer between block invocation. What am I missing here?
(Riding on Rails 3.2.22)