class RegionsController < InheritedResources::Base def icallist @regions = Region.all end def stats @region_events = Event.joins(:region).group(:name).count(:name) @city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city) @month_events = Event .group('extract(year from start_time)') .group('extract(month from start_time)') .count() end end