-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
Expected Behavior
No error when using the example code
Actual Behavior
Getting error FloatDomainError: Infinity when using example code for jsonapi_page_size
Steps to Reproduce the Problem
Include code
def jsonapi_page_size(pagination_params)
per_page = pagination_params[:size].to_f.to_i
per_page = 30 if per_page > 30
per_page
end
and don't provide size in the params. Method jsonapi_pagination_params will return limit 0 and jsonapi_pagination_meta will divide by it's value of 0, causing the error.
Fixed it for me by updating the code to per_page = 30 if per_page > 30 || per_page === 0
Specifications
- Version: 1.7.0
- Ruby version: 2.5.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels