Les événements globaux sont affichés pour toutes les régions

This commit is contained in:
echarp 2014-06-01 15:06:04 +02:00
parent 2b9d59b2a2
commit 6a786a16c1

View File

@ -26,8 +26,8 @@ class Event < ActiveRecord::Base
"#{year}-#{month.to_i-1}-23",
"#{month == '12' ? year.to_i+1 : year}-#{month == '12' ? 1 : month.to_i+1}-7"
}
scope :region, -> region { where region: region }
scope :tag, -> tag { where "tags like ?", "%#{tag}%" }
scope :region, -> region { where 'region = ? or locality', region }
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
before_validation(on: :create) do