Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
d6adff5294c7
Commit
b7b49c4a
authored
Aug 25, 2017
by
Mike Greiling
Browse files
prefer !x.exists? instead of x.none? to prevent unnecessary instantiation of records
parent
bb231873fbdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/group.rb
View file @
d6adff52
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment