I want to make my current will_paginate that looks like this:
<-Previous 1 2 3 4 5 Next->
Look like this
<-Previous 1 2 Next->
How do I 开发者_开发知识库control the amount of pages that can be displayed between previous and next?
The inner_window
and outer_window
properties can be used to manipulate how many page links you see on each page. You can pass them to the will_paginate
method on your view (if you only want to limit the number of links for one page).
If you want to limit the number of pages shown throughout your application, the best approach is an initializer file (call it something like will_paginate.rb). You can set global configuration options like so:
WillPaginate::ViewHelpers.pagination_options[:inner_window] = 3
WillPaginate::ViewHelpers.pagination_options[:outer_window] = 2
精彩评论