summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2016-03-17 15:56:44 +0200
committerAchilleas Pipinellis <axilleas@axilleas.me>2016-03-17 15:56:44 +0200
commit5b1db58c852d6b36b91a61ec66e2f3cb5187f3a2 (patch)
tree17d90632a853b6ff92a04a44ae156557da813a49 /app/models/project.rb
parenta6f5304280d95c496b7669d1553cc6c246f11f94 (diff)
parent4171933c0963696626c879c2d05afa1594a71d99 (diff)
downloadgitlab-ce-5b1db58c852d6b36b91a61ec66e2f3cb5187f3a2.tar.gz
Merge branch 'master' into rm_duplicate_cache_ci_docs
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 79e0cc7b23d..89a55a510cd 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -286,7 +286,14 @@ class Project < ActiveRecord::Base
or(ptable[:description].matches(pattern))
)
+ # We explicitly remove any eager loading clauses as they're:
+ #
+ # 1. Not needed by this query
+ # 2. Combined with .joins(:namespace) lead to all columns from the
+ # projects & namespaces tables being selected, leading to a SQL error
+ # due to the columns of all UNION'd queries no longer being the same.
namespaces = select(:id).
+ except(:includes).
joins(:namespace).
where(ntable[:name].matches(pattern))
@@ -508,6 +515,7 @@ class Project < ActiveRecord::Base
end
def external_issue_tracker
+ return @external_issue_tracker if defined?(@external_issue_tracker)
@external_issue_tracker ||=
services.issue_trackers.active.without_defaults.first
end