Showing pagination with only single page using will_paginate
I'm using will_paginate
as standard, but it only shows the pagination controls (< 1 2 > etc) when there's more than one page to display. Normally, this would be what is wanted, but I want to see the pagination controls (for UI consistency and to get round an annoying CSS quirk in the system I'm working on) even when there's only 1 page to display (showing < 1 >).
Is this poss开发者_如何学Goible?
The default will_paginate helper returns nil
when there is only one page, so you could do something like this:
<%= will_paginate(@records) || your_single_page_state_html %>
精彩评论