diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-03-03 09:59:25 +0300 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-03-23 11:11:48 +0300 |
commit | ba27f1b954e79713ec1905b46ee5ba1b940418f0 (patch) | |
tree | 740464cf3bc1c20fe45755e96e474261b9eac090 /app/serializers/pipeline_serializer.rb | |
parent | 0e06cfc059af0b70b366ab1eaf75f7601fdcb5e1 (diff) |
Expose only status. ci_cd_status to status. Support abstract class.
Diffstat (limited to 'app/serializers/pipeline_serializer.rb')
-rw-r--r-- | app/serializers/pipeline_serializer.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index ab2d3d5a3ec..4de9e620f64 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -11,11 +11,19 @@ class PipelineSerializer < BaseSerializer @paginator.present? end + def with_status + tap { @status_only = {only: [{details: [:status]}]} } + end + def represent(resource, opts = {}) if resource.is_a?(ActiveRecord::Relation) resource = resource.includes(project: :namespace) end + if @status_only.present? + opts.merge!(@status_only) + end + if paginated? super(@paginator.paginate(resource), opts) else |