Join on association

This commit is contained in:
Lin Jen-Shin 2016-07-20 19:27:53 +08:00
parent 66c8c3d4c3
commit a563f33113

View file

@ -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)
Ci::Build.joins(:pipeline).merge(pipelines.latest_successful_for(ref)).
builds.joins(:pipeline).merge(pipelines.latest_successful_for(ref)).
latest_successful_with_artifacts
end