From 2fe8ebc143737390ea8ba952ad1b8ba4c82dae84 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Wed, 20 Jul 2016 18:06:35 +0800 Subject: We need INNER JOIN to get the right pipeline, also added a test for checking this. --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/project.rb') 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 -- cgit v1.2.1