# Collection grouping/sorting question

**URL:** <https://www.ruby-forum.com/t/collection-grouping-sorting-question/183112>\
**Category:** Rails\
**Created:** [February 8, 2010, 1:02pm UTC](https://www.ruby-forum.com/t/collection-grouping-sorting-question/183112 "2010-02-08T13:02:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [February 8, 2010, 1:02pm UTC](https://www.ruby-forum.com/t/collection-grouping-sorting-question/183112/1 "2010-02-08T13:02:49Z")

</div>

@coll= [{:period=\>{:people=\>[#], :date=\>Sun, 08 Feb 2009}},  
{:period=\>{:people=\>[#, #, #, #, #, #, #, #, #, #, #, #, #, #, #, #,  
#, #], :date=\>Sun, 15 Feb 2009}}, {:period=\>{:people=\>[#, #, #, #, #,  
#, #, #, #, #, #, #, #, #], :date=\>Sun, 22 Feb 2009}},  
{:period=\>{:people=\>[#, #], :date=\>Sat, 28 Feb 2009}},  
{:period=\>{:people=\>[#, #, #, #, #, #, #], :date=\>Sun, 01 Mar 2009}},  
{:period=\>{:people=\>[#, #, #], :date=\>Sun, 08 Mar 2009}},  
{:period=\>{:people=\>[#, #, #, #, #, #], :date=\>Sun, 15 Mar 2009}},  
{:period=\>{:people=\>[#], :date=\>Wed, 18 Mar 2009}},  
{:period=\>{:people=\>[#, #, #], :date=\>Sun, 22 Mar 2009}},  
{:period=\>{:people=\>[#], :date=\>Sun, 29 Mar 2009}},  
{:period=\>{:people=\>[#, #, #, #, #, #, #, #, #, #], :date=\>Sun, 05 Apr  
2009}}, {:period=\>{:people=\>[#], :date=\>Sun, 12 Apr 2009}},  
{:period=\>{:people=\>[#, #, #, #, #, #, #, #, #, #, #], :date=\>Sun, 19  
Apr 2009}}, {:period=\>{:people=\>[#, #, #, #, #, #, #, #,  
#], :date=\>Sun, 26 Apr 2009}}, {:period=\>{:people=\>[#, #, #, #, #, #,  
#, #, #, #, #, #, #, #, #, #], :date=\>Sun, 03 May 2009}}]

I have the above collection of hashes. Each hash has a date and a  
collection of people objects. I want to group this collection by month  
according to the date attribute. What’s a good way to do this? I can’t  
think…
