什麼是以5行顯示20個圖像列表的最佳方式?或者換句話說,我該如何清理這個醜陋的片段?循環每個x元素
<div class="row">
<% @images.each_with_index do |image, index| %>
<% if index != 0 && index % 5 == 0 %>
</div><div class="row">
<% end %>
<%= image_tag image.url %>
<% end %>
</div>
很酷,這是一個更清潔的解決方案。感謝Pär! – Cimm 2010-03-22 10:07:26