13 lines
381 B
Ruby
13 lines
381 B
Ruby
class RegionsController < InheritedResources::Base
|
|
def stats
|
|
@region_events = Event.joins(:related_region).group(:name).count(:name)
|
|
|
|
@city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city)
|
|
|
|
@month_events = Event
|
|
.group('strftime("%Y", start_time)')
|
|
.group('strftime("%m", start_time)')
|
|
.count()
|
|
end
|
|
end
|