fix api pagination limit

pull/109/head
DocuSeal 2 years ago committed by Pete Matsyburka
parent 3ade45f541
commit c227a1988a

@ -25,7 +25,7 @@ module Api
def paginate(relation)
result = relation.order(id: :desc)
.limit([params[:limit] || DEFAULT_LIMIT, MAX_LIMIT].min)
.limit([params.fetch(:limit, DEFAULT_LIMIT).to_i, MAX_LIMIT].min)
result = result.where('id < ?', params[:after]) if params[:after].present?
result = result.where('id > ?', params[:before]) if params[:before].present?

Loading…
Cancel
Save