From: stephen O'D Date: 2006-08-02T07:15:11+09:00 Subject: Rails view template for a gallery I am totally new to rails, so sorry for the trivial question! I have an object, gallery, that contains a list of images. I want to display these images in a table with 4 columns and as many rows as it takes, closing the final table row at the end. What is the best way todo this? I can do it (mostly, the final table row is still left open) using the following template, but it seems a bit hackish in places:

<%= @gallery.name -%>

<% i = 1 for img in @gallery.images -%> <%= if i == 1 || (i-1)%4 == 0 "" else "" end -%> <%= "" if i%4 == 0 -%> <%= i += 1 "" -%> <% end -%>
Is there a better way?