好的,所以我有
>> list = Request.find_all_by_artist("someBand") => [#<Request id: 1,artist: "someBand",song: "someSong",venue: "Knebworth - Stevenage,United Kingdom",showdate: "2011-07-01",amount: nil,user_id: 2,created_at: "2011-01-01 18:14:08",updated_at: "2011-01-01 18:14:09".............
接着
list.group_by(&:created_at).map {|k,v| [k,v.length]}.sort => [[Sat,01 Jan 2011 18:14:08 UTC +00:00,10],[Sun,09 Jan 2011 18:34:19 UTC +00:00,1],09 Jan 2011 18:38:48 UTC +00:00,09 Jan 2011 18:51:10 UTC +00:00,09 Jan 2011 18:52:30 UTC +00:00,[Thu,10 Feb 2011 02:22:08 UTC +00:00,10 Feb 2011 20:02:20 UTC +00:00,1]]
问题是我有几个太阳,1月9日和10日的一对,而不是这样的一个
这是我需要的
=> [[Sat,4],2]]