Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (52 sloc) 1.28 KB

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: