Rails each loop insert tag every 6 items?

Posted by dustmoo on Stack Overflow See other posts from Stack Overflow or by dustmoo
Published on 2010-05-17T19:00:26Z Indexed on 2010/05/17 19:10 UTC
Read the original article Hit count: 246

Filed under:
|
|

Hello Stack Anon,

I have X number of image objects that I need to loop through in a view and want to create a new div every 6 objects or so (for a gallery).

I have looked at cycle but it seems to change every other record. Does anyone know of a way to insert code into a view every 6 times?

I could probably do it with nested loops but I am kinda stumped on this one.

Thanks!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails