organize by a field

Matt,

You could do a sort like this:

<% for album in artist.albums.sort_by{ |a| a.release_date } %>

or better yet look at adjusting your has_many call to:

has_many :albums, :order => 'release_date'

Hope this helps.

Matt,

I don't understand exactly what you want here... if we have two artists with release dates like this:

Artist 1 has albums with release_dates of 1/1/06, 3/1/06, 5/1/06 Artist 2 has albums with release_dates of 2/1/06, 4/1/06

then <% for artist in @artists %> won't work because they have releases that stagger. What you want to do if the primary sort is release date is something like the following:

@albums = Album.find(:all, :include => :artist, :order => 'release_date')

then

<% for album in @albums -%>   <%= album.release_date.strftime(...) %> - <%= album.artist.name %> <% end -%>

Does that make sense?