From f7ecdfdfbf79953351f556340911f8788c02b265 Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 26 Jul 2014 18:41:37 +0200 Subject: [PATCH] =?UTF-8?q?Rapide=20correction,=20mysql=20ne=20comprend=20?= =?UTF-8?q?que=20la=20fonction=20extract=20pour=20extraire=20mois=20et=20a?= =?UTF-8?q?nn=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/regions_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/regions_controller.rb b/app/controllers/regions_controller.rb index 770ffd85..1f001d0e 100644 --- a/app/controllers/regions_controller.rb +++ b/app/controllers/regions_controller.rb @@ -4,9 +4,12 @@ class RegionsController < InheritedResources::Base @city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city) + # Used in sqlite + #.group('strftime("%Y", start_time)') + #.group('strftime("%m", start_time)') @month_events = Event - .group('strftime("%Y", start_time)') - .group('strftime("%m", start_time)') + .group('extract(year from start_time)') + .group('extract(month from start_time)') .count() end end