summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-06-07 12:57:40 +0000
committerDouwe Maan <douwe@gitlab.com>2017-06-07 12:57:40 +0000
commit013285e951503d9cea8e0c0d0b8a3ac139ff6415 (patch)
treed7d65a32d671a02e5ae5f2847202c5b804c25846 /app/serializers
parentd27db3eaede283f1061d4ad433e6d92680343e72 (diff)
parentc698f10942ebdf44d0c2a6559277bc6a89d26c5b (diff)
downloadgitlab-ce-013285e951503d9cea8e0c0d0b8a3ac139ff6415.tar.gz
Merge branch 'issue_27166_2' into 'master'
Avoid repeated queries for pipeline builds on merge requests See merge request !11888
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/pipeline_serializer.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb
index b428ff69fe8..661bf17983c 100644
--- a/app/serializers/pipeline_serializer.rb
+++ b/app/serializers/pipeline_serializer.rb
@@ -13,14 +13,15 @@ class PipelineSerializer < BaseSerializer
def represent(resource, opts = {})
if resource.is_a?(ActiveRecord::Relation)
+
resource = resource.preload([
:retryable_builds,
:cancelable_statuses,
:trigger_requests,
:project,
- { pending_builds: :project },
- { manual_actions: :project },
- { artifacts: :project }
+ :manual_actions,
+ :artifacts,
+ { pending_builds: :project }
])
end