The &:age means that the group_by method should call the age method on the array items to get the group by data. This age method is not defined on the items which are Hashes in your case.
This should work:
array.group_by { |d| d[:age] }
The &:age means that the group_by method should call the age method on the array items to get the group by data. This age method is not defined on the items which are Hashes in your case.
This should work:
array.group_by { |d| d[:age] }