Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mserran2 opened this issue Oct 8, 2015 · 3 comments

Comments

@mserran2
Copy link

mserran2 commented Oct 8, 2015

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)>'
mserran2 pushed a commit to mserran2/will_paginate that referenced this issue Oct 8, 2015
- Fix total_pages method to work with per_page = 0
mserran2 pushed a commit to mserran2/will_paginate that referenced this issue Oct 8, 2015
- Fix total_pages method to work with per_page = 0
@shirren
Copy link

shirren commented Mar 1, 2016

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

@sfate
Copy link

sfate commented Jun 17, 2016

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.

@mserran2
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants