-
Notifications
You must be signed in to change notification settings - Fork 865
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
updated the page method, added args to AR page method #276
Conversation
…tive-record, now its possible to add default_page param e.g. page('foo', :default_page => 2) to get no exception in case of invalid pagenum ("foo") and to set a default page if its not page one
Any chance to get this fixed? Users keep changing URL and we get lots of errors because of this... cc @mislav |
Nope, I don't find the feature useful. The exception is deliberate so you can handle it in your application. posts = Post.where(:published => true)
begin
posts = posts.page(params[:page])
rescue ArgumentError
posts = posts.page(default_page)
end Or you could massage |
In every action in your application that uses pagination? That's not very practical. |
@mislav I think I could handle that exception in our apps if it would be different from the too common |
@dgilperez You could be handling |
@mislav sorry for being too fast on that. Peeping on the code I see |
In my fork its possible to set a default_page as a argument for the page method. If param[:page] is invalid, the page method would return the default_page and is not raising an exception, like it is now for the issue #271
with best regards