Class: AhoyCaptain::RegionQuery
- Inherits:
-
ApplicationQuery
- Object
- ApplicationQuery
- AhoyCaptain::RegionQuery
- Defined in:
- app/queries/ahoy_captain/region_query.rb
Instance Attribute Summary
Attributes inherited from ApplicationQuery
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
#build ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/queries/ahoy_captain/region_query.rb', line 3 def build visit_query .reselect("region, country, count(concat(region, country)) as count, sum(count(region)) over() as total_count") .where.not(region: nil) .group("region, country") .order(Arel.sql "count(concat(region, country)) desc") end |