I have an activerecord method that finds all events in a week
myevents.map { |x| x.start_date.day => [x.title]}
(start_date is a date and time field, name is a string) which gives me an array of hashes;
[{11=>["40"]}, {11=>["0"]}, {11=>["0"]}, {11=>[""]},
{11=>["0"]}, {11=>["0"]}, {11=>["33"]}, {12=>["9"]},
{11=>["34"]}, {11=>["29"]}, {11=>["8"]}, {11=>["31"]},
{11=>["40"]}, {11=>["34"]}]
I want to map values to get an array that looks like this:
[ {11=>[ average of values that occur on the 11th]},
{12=>[average of values that occur on the 12th]} ]
but I'm not quite sure how to get this.
source
share