diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-08-25 15:54:05 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-08-26 03:31:14 -0500 |
commit | b7b49c4a15e592904a41df72aa5ab9b791abc0ef (patch) | |
tree | eb9602162f7be009291ba07abc2980f24bc619cd /app/models/group.rb | |
parent | 1c3b3facb7a2296ca10dcb57b4f3b8ba416ffd3b (diff) | |
download | gitlab-ce-b7b49c4a15e592904a41df72aa5ab9b791abc0ef.tar.gz |
prefer !x.exists? instead of x.none? to prevent unnecessary instantiation of records
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 78084f76869..d4d201f05b7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -129,11 +129,11 @@ class Group < Namespace 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) |