Quick correction, to manage the region zero

rails5
echarp 5 years ago
parent 9638996386
commit 12ba0c42dd
  1. 2
      app/models/event.rb
  2. 2
      app/models/orga.rb

@ -64,7 +64,7 @@ class Event < ApplicationRecord
start_date, start_date.end_of_week.end_of_day
end)
scope :region, (lambda do |region|
return if region.nil? || region == 'all' || region.zero?
return if region.nil? || region == 'all' || region.to_i.zero?
temp = Region.find region
where region: [temp, temp.regions].flatten
end)

@ -33,7 +33,7 @@ class Orga < ApplicationRecord
scope :kind, ->(kind) { where kind: kind }
scope :region, (lambda do |region|
return if region.nil? || region == 'all' || region.zero?
return if region.nil? || region == 'all' || region.to_i.zero?
temp = Region.find region
where region: [temp, temp.regions].flatten
end)

Loading…
Cancel
Save