Ruby’s each_slice() makes it easy to split rows of data. This is especially useful when formatting tables or rows of data in templates. The following will provide a three column layout repeating down the page.

  <% @posts.each_slice(3) do |row| %>
    
<% row.each do |post| %>
<% end %>
<% end %>

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.