diff --git a/app/controllers/api/api_base_controller.rb b/app/controllers/api/api_base_controller.rb index d85692bc..acaef82f 100644 --- a/app/controllers/api/api_base_controller.rb +++ b/app/controllers/api/api_base_controller.rb @@ -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?