Commit b7b49c4a authored by Mike Greiling's avatar Mike Greiling
Browse files

prefer !x.exists? instead of x.none? to prevent unnecessary instantiation of records

parent bb231873fbdf
......@@ -129,11 +129,11 @@ def visibility_level_allowed_by_parent?(level = self.visibility_level)
end
def visibility_level_allowed_by_projects?(level = self.visibility_level)
projects.where('visibility_level > ?', level).none?
!projects.where('visibility_level > ?', level).exists?
end
def visibility_level_allowed_by_sub_groups?(level = self.visibility_level)
children.where('visibility_level > ?', level).none?
!children.where('visibility_level > ?', level).exists?
end
def visibility_level_allowed?(level = self.visibility_level)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment