Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 possible?

like image 509
James Inman Avatar asked May 01 '10 23:05

James Inman


1 Answers

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 %>
like image 185
Jimmy Avatar answered Nov 03 '22 00:11

Jimmy