summaryrefslogtreecommitdiff
path: root/app/helpers/projects_helper.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-08-15 12:33:07 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-08-15 12:33:37 +0200
commitb401b3025b878d87a58cf22cee4b5be8fdfa762a (patch)
treed0a93c5913787cbfa3bd80e8ce53221cbd40a6d4 /app/helpers/projects_helper.rb
parent4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff)
downloadgitlab-ce-fix-any-projects-array.tar.gz
Allow usage of any_projects? with an Arrayfix-any-projects-array
In some cases we pass an Array to this method which would previously fail since Array does not respond to "limit_value". Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/3646
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r--app/helpers/projects_helper.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 09cfd06dad3..278d394bc03 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -234,6 +234,8 @@ module ProjectsHelper
# If no limit is applied we'll just issue a COUNT since the result set could
# be too large to load into memory.
def any_projects?(projects)
+ return projects.any? if projects.is_a?(Array)
+
if projects.limit_value
projects.to_a.any?
else