Skip to content

Instantly share code, notes, and snippets.

@wegorich
Created September 13, 2013 13:23
Show Gist options
  • Save wegorich/6550669 to your computer and use it in GitHub Desktop.
Save wegorich/6550669 to your computer and use it in GitHub Desktop.
Create hash from active record by field
x.select('moderator, COUNT(*) count').group('moderator').inject({}){|h, o| h[o.moderator=="t"] = o; h }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment