You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to allow a way to handle out of bounds paging in a consistent way. Right now it's up to the calling code to call #out_of_bounds? and then to handle it on a case-by-case basis.
My scenario is that I want to send the person to page #1 if they happen to pick a per_page and page combination that is no longer valid:
class ApplicationController
rescue_from WillPaginate::OutOfBoundsException do
redirect_to params.merge(:page => 1)
end
end
class MyController < ApplicationController
def index
@things = MyModel.paginate!(...)
end
end
This would work across controllers (or views) because you wouldn't need to know about what was being paginated on, just that you needed to redirect back to page 1. Thoughts?
The text was updated successfully, but these errors were encountered:
It would be nice to allow a way to handle out of bounds paging in a consistent way. Right now it's up to the calling code to call #out_of_bounds? and then to handle it on a case-by-case basis.
My scenario is that I want to send the person to page #1 if they happen to pick a per_page and page combination that is no longer valid:
This would work across controllers (or views) because you wouldn't need to know about what was being paginated on, just that you needed to redirect back to page 1. Thoughts?
The text was updated successfully, but these errors were encountered: