开发者

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 %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜