On 11/28/07, John Kopanas
<kopanas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I want to take a list and break it up into 4 lists equally and depending on
> what list I am trying to brake up the list is going to be different. The
> reason I want to do this is so I can create columns. How would you take
the
> following list, and lists like that, and have it automatically brake across
> a couple of lists.
>
> <ul class="list_of_locations">
> <% for american_state in @american_states -%>
> <li><%= link_to american_state.name,
> administrative_area_path(american_state.id) %></li>
> <% end -%>
> </ul>
>
> Any suggestions? :-)
> --
> John Kopanas
> john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org
>
> Blog: http://www.kopanas.com
> Conference: http://www.cusec.net
> Twits: http://www.twitter.com/kopanas
> >
>
I think you''re looking for in_groups_of:
http://weblog.rubyonrails.org/2006/3/1/new-in-rails-enumerable-group_by-and-array-in_groups_of
Pat
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---