diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-07 15:57:40 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-07 15:57:40 +0300 |
commit | 013285e951503d9cea8e0c0d0b8a3ac139ff6415 (patch) | |
tree | d7d65a32d671a02e5ae5f2847202c5b804c25846 /app/models | |
parent | d27db3eaede283f1061d4ad433e6d92680343e72 (diff) | |
parent | c698f10942ebdf44d0c2a6559277bc6a89d26c5b (diff) |
Merge branch 'issue_27166_2' into 'master'
Avoid repeated queries for pipeline builds on merge requests
See merge request !11888
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index e28ba91bd64..9ddecba5183 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -23,8 +23,8 @@ module Ci has_many :pending_builds, -> { pending }, foreign_key: :commit_id, class_name: 'Ci::Build' has_many :retryable_builds, -> { latest.failed_or_canceled }, foreign_key: :commit_id, class_name: 'Ci::Build' has_many :cancelable_statuses, -> { cancelable }, foreign_key: :commit_id, class_name: 'CommitStatus' - has_many :manual_actions, -> { latest.manual_actions }, foreign_key: :commit_id, class_name: 'Ci::Build' - has_many :artifacts, -> { latest.with_artifacts_not_expired }, foreign_key: :commit_id, class_name: 'Ci::Build' + has_many :manual_actions, -> { latest.manual_actions.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build' + has_many :artifacts, -> { latest.with_artifacts_not_expired.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build' has_many :auto_canceled_pipelines, class_name: 'Ci::Pipeline', foreign_key: 'auto_canceled_by_id' has_many :auto_canceled_jobs, class_name: 'CommitStatus', foreign_key: 'auto_canceled_by_id' |