Missing region scope

remotes/origin/master
echarp 5 years ago
parent 3e044ca64a
commit 2ee90cd937
  1. 5
      app/models/region.rb

@ -6,6 +6,11 @@ class Region < ApplicationRecord
has_many :orgas, dependent: :destroy
default_scope { order :name }
scope :region, (lambda do |region|
return if region.nil? || region == 'all' || region.to_i.zero?
temp = Region.find region
where region: [temp, temp.regions].flatten
end)
def to_s
name

Loading…
Cancel
Save