A nice shortcut for group count queries
Ruby
Latest commit edc0d76 Oct 7, 2016 @ankane Fixed build
Permalink
Failed to load latest commit information.
lib Use keyword arguments Oct 7, 2016
test Use keyword arguments Oct 7, 2016
.gitignore First commit May 11, 2014
.travis.yml Fixed build Oct 7, 2016
CHANGELOG.md Use keyword arguments Oct 7, 2016
Gemfile Updated style Mar 11, 2015
LICENSE.txt First commit May 11, 2014
README.md Added distinct option to replace uniq Feb 4, 2016
Rakefile Updated style Mar 11, 2015
hightop.gemspec Updated style Mar 11, 2015

README.md

Hightop

A nice shortcut for group count queries

Build Status

Visit.top(:browser)

instead of

Visit.group(:browser).where("browser IS NOT NULL").order("count_all DESC, browser").count

Be sure to sanitize user input like you must with group.

Limit the results

Visit.top(:referring_domain, 10)

Include nil values

Visit.top(:search_keyword, nil: true)

Works with multiple groups

Visit.top([:city, :browser])

And expressions

Visit.top("LOWER(referring_domain)")

And distinct

Visit.top(:city, distinct: :user_id)

And min count

Visit.top(:city, min: 10)

Installation

Add this line to your application’s Gemfile:

gem 'hightop'

And then execute:

bundle

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: