Missing region scope
This commit is contained in:
parent
3e044ca64a
commit
2ee90cd937
@ -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…
Reference in New Issue
Block a user