summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-07-20 18:06:35 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-07-20 18:06:35 +0800
commit2fe8ebc143737390ea8ba952ad1b8ba4c82dae84 (patch)
treef51e495fd0c95cd14454e00e3d8a233c8d0b14b2 /app/models/project.rb
parent3925436a9582ec35c0eb4fddaeeaf71c23076754 (diff)
downloadgitlab-ce-2fe8ebc143737390ea8ba952ad1b8ba4c82dae84.tar.gz
We need INNER JOIN to get the right pipeline,
also added a test for checking this.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 026fff0da0c..f2e9d607967 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -431,7 +431,7 @@ class Project < ActiveRecord::Base
# ref can't be HEAD, can only be branch/tag name or SHA
def latest_successful_builds_for(ref = default_branch)
- builds.where(pipeline: pipelines.latest_successful_for(ref)).
+ Ci::Build.joins(:pipeline).merge(pipelines.latest_successful_for(ref)).
latest_successful_with_artifacts
end