Not sure that you would want to do this but you can

a = (1..20).to_a

until a.empty?
  x = a.slice!(0,3)
  puts x.inspect
end

Gives

[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10, 11, 12]
[13, 14, 15]
[16, 17, 18]
[19, 20]

so you could have

<table>
<% until @photos.empty? -%>
<% x = @photos.slice!(0,3) -%>
<tr>
<% x.each do |y| -%>
<td><%= y %></td>
<% end -%>
</tr>
<% end -%>
</table>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to