mislav/will_paginate

per page = 0 causes FloatDomainError:Infinity when total_pages is called.

Opened this issue · 3 comments

next_page, previous_page and total_pages all cause an Infinity error when to be thrown when the per_page variable is set to 0.

FloatDomainError:
   Infinity
 # ./lib/will_paginate/collection.rb:16:in `ceil'
 # ./lib/will_paginate/collection.rb:16:in `total_pages'
 # ./spec/collection_spec.rb:83:in `block (3 levels) in <top (required)>'

I can confirm that this is still an issue. Any reason it has not been released?

sfate commented

Same issue here.
Also occurs on passing empty string as per_page value.

Just need to check that you got proper integer value before passing it to paginate.

There's an open pull request for this, but it has yet to be merged: #453