diff options
Diffstat (limited to 'app/serializers/environment_serializer.rb')
-rw-r--r-- | app/serializers/environment_serializer.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/serializers/environment_serializer.rb b/app/serializers/environment_serializer.rb index 2bb9a7e7254..2fb1ad52135 100644 --- a/app/serializers/environment_serializer.rb +++ b/app/serializers/environment_serializer.rb @@ -23,6 +23,8 @@ class EnvironmentSerializer < BaseSerializer latest: super(item.latest, opts) } end else + resource = @paginator.paginate(resource) if paginated? + super(batch_load(resource), opts) end end @@ -52,7 +54,7 @@ class EnvironmentSerializer < BaseSerializer def batch_load(resource) resource = resource.preload(environment_associations) - resource.all.tap do |environments| + resource.all.to_a.tap do |environments| environments.each do |environment| # Batch loading the commits of the deployments environment.last_deployment&.commit&.try(:lazy_author) @@ -96,4 +98,4 @@ class EnvironmentSerializer < BaseSerializer # rubocop: enable CodeReuse/ActiveRecord end -EnvironmentSerializer.prepend_if_ee('EE::EnvironmentSerializer') +EnvironmentSerializer.prepend_mod_with('EnvironmentSerializer') |