Presenting a grouped list of objects from STI

Ryan Glover wrote:

What is the best method for building the output in the view? Should I use acts_as_list or tree? You'll notice I also want to have the count for each type. Is there a built in way to do this or should I hack something together?

I would use Enumerable#group_by

@people = Person.find(:all) @people_by_type = @people.group_by(&:class)

Number of managers: @people_by_type[Manager].size Number of employees: @people_by_type[Employee].size etc.

To loop through: <% for klass in @people_by_type.keys %>   <% for person in @people_by_type[klass] %>     .....

Dan Manges