Listing elements from a table

I am writing an application where users can become members of different groups. On each group page I want to list all the members of the group by user name and also the groups to which they belong. My group table consistes of id, name, description. My membership table consists of id, user_id, group_id, role.

How would I define the members and groups in my controller to do this and also how could I list them in my views?

Thanks in advance,

Steve.

Those are some of the things I can think of that should help you build your group show pages. Hope this gives you some ideas on how to proceed.

Thanks a million. Thats helps me a great deal. Sometimes you cant see the wood for the trees!

Stephen Fagan wrote:

Those are some of the things I can think of that should help you build your group show pages. Hope this gives you some ideas on how to proceed.

Thanks a million. Thats helps me a great deal. Sometimes you cant see the wood for the trees!

Also don't forget about default_scope. That can be very useful for providing default sort orderings to your models:

http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M002363&name=default_scope