summaryrefslogtreecommitdiff
path: root/app/models/concerns/routable.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 06:06:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 06:06:27 +0000
commit9735395f94088df7e6470e3e8a2638385ede36b6 (patch)
treefbd42e043d05dbc78872b0458baac3a216ea232e /app/models/concerns/routable.rb
parent33586a7aa128171b1bbc9380648b6945b09f5e2d (diff)
downloadgitlab-ce-9735395f94088df7e6470e3e8a2638385ede36b6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/routable.rb')
-rw-r--r--app/models/concerns/routable.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb
index bdd87437e2a..129d0fbb2c0 100644
--- a/app/models/concerns/routable.rb
+++ b/app/models/concerns/routable.rb
@@ -51,14 +51,21 @@ module Routable
# Klass.where_full_path_in(%w{gitlab-org/gitlab-foss gitlab-org/gitlab})
#
# Returns an ActiveRecord::Relation.
- def where_full_path_in(paths)
+ def where_full_path_in(paths, use_includes: true)
return none if paths.empty?
wheres = paths.map do |path|
"(LOWER(routes.path) = LOWER(#{connection.quote(path)}))"
end
- includes(:route).where(wheres.join(' OR ')).references(:routes)
+ route =
+ if use_includes
+ includes(:route).references(:routes)
+ else
+ joins(:route)
+ end
+
+ route.where(wheres.join(' OR '))
end
end