Class: AhoyCaptain::CountryQuery

Inherits:
ApplicationQuery show all
Defined in:
app/queries/ahoy_captain/country_query.rb

Instance Attribute Summary

Attributes inherited from ApplicationQuery

#params

Instance Method Summary collapse

Methods inherited from ApplicationQuery

call, inherited, #initialize, #inspect

Constructor Details

This class inherits a constructor from AhoyCaptain::ApplicationQuery

Instance Method Details

#buildObject



3
4
5
6
7
8
# File 'app/queries/ahoy_captain/country_query.rb', line 3

def build
  visit_query
    .reselect("country as label, count(country) as count, sum(count(country)) OVER() as total_count")
    .group("country")
    .order("count(country) desc")
end