/hightop

A nice shortcut for group count queries

Primary LanguageRubyMIT LicenseMIT

Hightop

A nice shortcut for group count queries

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, uniq: :user_id)

And min count [master]

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: