Staggered loading of products in BPE

This commit is contained in:
Rob H
2014-08-01 13:36:29 +10:00
parent b9f49344b4
commit 27e992ebcb
4 changed files with 49 additions and 50 deletions

View File

@@ -9,7 +9,7 @@ Spree::Api::ProductsController.class_eval do
def bulk_products
@products = product_scope.ransack(params[:q]).result.managed_by(current_api_user).page(params[:page]).per(params[:per_page])
render text: ActiveModel::ArraySerializer.new(@products, each_serializer: Spree::Api::ProductSerializer).to_json
render text: { products: ActiveModel::ArraySerializer.new(@products, each_serializer: Spree::Api::ProductSerializer), pages: @products.num_pages }.to_json
end
def soft_delete