fix products controller spec erros

This commit is contained in:
Paulo Vilarinho
2021-01-05 15:11:26 -03:00
parent c99b250a5f
commit f53089c16c
2 changed files with 3 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ module Api
@products = product_query.
ransack(query_params_with_defaults).
result.
page(params[:page] || DEFAULT_PAGE).
page(params[:page] || 1).
per(params[:per_page] || DEFAULT_PER_PAGE)
render_paged_products @products

View File

@@ -16,11 +16,9 @@ module PaginationData
params[:page].present? || params[:per_page].present?
end
private
def default_per_page
return unless defined? DEFAULT_PER_PAGE
return unless defined? self.class::DEFAULT_PER_PAGE
DEFAULT_PER_PAGE
self.class::DEFAULT_PER_PAGE
end
end