you need the method in_groups_of. Here's how I use it
<table> <% @products.in_groups_of(2, ' ') do |item| -%> <tr class="<%= cycle("item0","item1") %>"> <% item.each do |item| next unless item.respond_to?(:product_name) -%> <td> <%= item.product_name %> </td> <% end -%> </tr> <% end -%> </table>