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:

--- Entry 1
--- Entry 2
--- Entry 3

--- 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

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.


Google for "group_by". Here's some examples.

Awesome Phillip, this is very helpful, thanks.