diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 06:06:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 06:06:27 +0000 |
commit | 9735395f94088df7e6470e3e8a2638385ede36b6 (patch) | |
tree | fbd42e043d05dbc78872b0458baac3a216ea232e /app | |
parent | 33586a7aa128171b1bbc9380648b6945b09f5e2d (diff) | |
download | gitlab-ce-9735395f94088df7e6470e3e8a2638385ede36b6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/routable.rb | 11 |
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 |