On Sun, Mar 8, 2009 at 4:57 PM, Rob Scott
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> I''m trying to build a table out using in groups of, but
I''d also like to
> be able to customize the first and last rows.
>
> Apart from the actual formatting, is there an efficient way to figure
> out how many total groups there are and what group the iteration is in?
users = User.find(:all).in_groups_of( 3 )
users.first and users.last will be the first and last groups respectively.
users.size will be the total groups of users.
And then going forward you can figure all this out on your own using
users.methods.sort.. like seeing that users.class is an Array will let
you know you can use anything from the Array class on your users
collection.
--
Greg Donald
http://destiney.com/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---