Skip to content

Instantly share code, notes, and snippets.

@ganeshran
Created August 29, 2014 11:47
Show Gist options
  • Save ganeshran/adbca08937b655c28bb2 to your computer and use it in GitHub Desktop.
Save ganeshran/adbca08937b655c28bb2 to your computer and use it in GitHub Desktop.
2.0.0-p481 :009 > msgTypeHash = Message.all.group_by(&:dayofweek).map{ |k,v| [k,v.length] }
Message Load (1.0ms) SELECT "messages".* FROM "messages"
=> [["Tue", 1], ["Wed", 1], ["Thu", 3]]
#I am trying to get it in format format
{ {Tue:1},{Wed:1},{Thu:3}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment