http://weblog.rubyonrails.org/2006/3/1/new-in-rails-enumerable-group_by-and-array-in_groups_of
ed
On 10/27/06, Andrew Hite
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> Is it possible to select all records from a table, then iterate through
> the returned objects grouped by a datetime field?
>
> I have a table that has a datetime field called, well,
''datetime'', and a
> string field called (for example''s sake) ''name''.
>
> What I need to end up with is something along the lines of:
>
> <div class="month">
>
> <h1>January</h1>
>
> <div class="day">
>
> <h2>1</h2>
>
> <ul>
> <li>Name 1</li>
> <li>Name 2</li>
> </ul>
>
> </div>
>
> <div class="day">
>
> <h2>2</h2>
>
> <ul>
> <li>Name 3</li>
> <li>Name 4</li>
> </ul>
>
> </div>
>
> </div>
>
> How can I achieve this using Ruby/Rails? I can do it pretty easily
> using PHP, but I''m not sure how best to approach it w/ Ruby.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--
Ed Hickey
Developer
Litmus Media
816-533-0409
ehickey-A4HEbNdjHgMmlAP/+Wk3EA@public.gmane.org
A Member of Think Partnership, Inc
www.ThinkPartnership.com
Amex ticker symbol: THK
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---