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

Should will_paginate raise errors when page number is not an integer? #370

Closed
leods92 opened this issue Apr 2, 2014 · 4 comments
Closed

Comments

@leods92
Copy link

leods92 commented Apr 2, 2014

I don't think so.
We usually send a page parameter straight into will_paginate.
Since this seems to be a common practice, I think will_paginate should handle it properly.

In PageNumber#initialize, there's a call to Integer which raises exceptions if value is not parseable. I think we should rescue that.

https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/page_number.rb#L16

Am I missing anything here?

Great job, btw, @mislav 😄
This gem saves lives...

@furiabhavesh
Copy link

Yes @leods92, I got this exception today and need this issue to be fixed.

@furiabhavesh
Copy link

But why & where does the page number become a non Integer value ? In my case it was "45."

@darrenterhune
Copy link

Add constraints to your app: #271

@mislav
Copy link
Owner

mislav commented Jun 18, 2014

Yep, the exception for invalid page numbers is deliberate. You shouldn't be experiencing errors anyway unless something goes terribly wrong with your pagination links, or a bot hits your site with nonsense query parameters. All of these problems should be remedied in your app under your choosing.

@mislav mislav closed this as completed Jun 18, 2014
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

4 participants