Listing entries under corresponding date

I have a rails app with view code long in need of an overhaul. Some
of the first app code I wrote was designed to display entires
belonging to a given date, under a date header derived from a model
timestamp field. For each day, I list the corresponding entries for
that day under the date as a header. Here’s an example:

07/09/1976
— Entry 1
— Entry 2
— Entry 3

07/08/1976
— Entry 1
— Entry 2

The results are in a @diary object which I loop through. I’d be happy
to post my code, which is ugly, though i wanted to find out if there
was a helper to do this, or if there’s a technique that people use to
easily:

  1. extract the date from a timestamp, and write it as a header
  2. list all the corresponding entries for that day underneath it

…etc. etc.

Any techniques out there to use? …or are there any helpers I might
not know about to make this work?

Thanks for your help in advance.

-A

On Jun 30, 2008, at 11:55 AM, ressister wrote:

— Entry 3

  1. extract the date from a timestamp, and write it as a header
  2. list all the corresponding entries for that day underneath it

…etc. etc.

Any techniques out there to use? …or are there any helpers I might
not know about to make this work?

Google for “group_by”. Here’s some examples.

Awesome Phillip, this is very helpful, thanks.

-A