diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-06 17:07:13 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-06 17:07:13 +0300 |
commit | a7420b77bd9b7038af3702d3665faab317048d3a (patch) | |
tree | eb96b3ec5c303aa6ea2573122586b397b1207fa9 /app/serializers/pipeline_serializer.rb | |
parent | 81eb5c7fd79897d63e733e99b8fc4424dc8ea38a (diff) |
Add specs for standalone pagination for serializers
Diffstat (limited to 'app/serializers/pipeline_serializer.rb')
-rw-r--r-- | app/serializers/pipeline_serializer.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index 731ccfe90b3..245298db3c3 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -12,10 +12,11 @@ class PipelineSerializer < BaseSerializer end def represent(resource, opts = {}) - if paginated? - raise InvalidResourceError unless resource.respond_to?(:page) - + if resource.is_a?(ActiveRecord::Relation) resource = resource.includes(project: :namespace) + end + + if paginated? super(@paginator.paginate(resource), opts) else super(resource, opts) |