Q:

Ruby - Iterate over array and create a three column, x rows table

In a view, I get an array of objects.  I want to have a three column table that will be filled with an attribute of those objects.  So, if my list has 5 objects, my table will have two rows: the first row will contain three cells, and the second row 2 cells.
How do I iterate over that list in order to accomplish this?

A:

If you really want to use tables and just iterate over your array you could use each_slice and go over the returned arrays, like your_array.each_slice(3)
But you could also not use tables, use some divs for example, and iterate over your big (5 objects) array and style the divs so that they fit 3 in a row.

