Skip to content

Instantly share code, notes, and snippets.

@lxneng
Created March 18, 2010 06:28
Show Gist options
  • Save lxneng/336102 to your computer and use it in GitHub Desktop.
Save lxneng/336102 to your computer and use it in GitHub Desktop.
counts = Users.count(:group => :country)
counts.each |country, count| do
p "#{country} - #{count}"
end
# Prints
US 123
UK 54
DE 33
counts["UK"] #-> prints 123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment