Hello there, I''m stuck! I''m trying to write a mini app to track versions of songs that have been sent out to members. I have the following tables/models: songs/song has_many :releases versions/version has_and_belongs_to_many :members belongs_to :songs members/member has_and_belongs_to_many :versions songs ====Song1 Song2 Song3 members ======John Paul George Ringo The versions table lists all versions for all sings and is joined to members via join table "members_versions". I want a table which shows the latest versions members have for each song John Paul George Ringo Song1 1 2 1 Song2 3 3 1 Song3 1 1 2 2 This table then shows that eg: Song1 version 2 has only been sent to Paul, that the latest version John and Ringo have is release 1 and that George (poor sod) hasn''t received any version. I can get the table to display the following: Song John Paul George Ringo Song1 1 1,2 1 Song2 1,2,3 1,2,3 1 Song3 1 1 1,2 1,2 where all received versions are listed using the following code in my view.rhtml file: <table> <tr> <th>Song</th> <% @members.each do |member| %> <th width = ''100'' align = ''center''><%= member.name <http://member.name>%></th> <% end %> </tr> <% @songs.each do |song| %> <tr> <td><%= song.name <http://song.name> %></td> <% @members.each do |member| %> <td> <% member.versions.each do |version| %> <% if version.song_id == song.id <http://song.id> %> <%= version.version_no %> <% end %> <% end %> </td> <% end %> </tr> <% end %> </table> _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails