RE: grouped output

I think you will want to use the new group_by function. Here is an

p = Person.find(:all)
grouped = p.group_by(&:center)

Now ‘grouped’ is a hash where the key is ‘center’ and the value of the
hash is the groups of people.

Now you can do:

grouped.each do |center, person|
puts center
person.each do |p|
List out the people

Further reading at:

Thanks for the link David, will check it out.

Thanks again,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs