Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using custom names with will_paginate

I'm using Mislav's will_paginate and I want to use the render option as shown in the repository's docs:

<%= page_entries_info @posts %>  #-> Displaying posts 6 - 10 of 26 in total

My particular model is named CoPosts, which is not as friendly as Post. I would love to use their render option but I would like to change Displaying co_posts 6-10 to Displaying posts 6-10...

How can I change the name will_paginate uses for its rendering?

like image 220
sscirrus Avatar asked Mar 22 '26 19:03

sscirrus


1 Answers

I believe you want to do something like this:

<%= page_entries_info @co_posts, :entry_name => 'post' %>

You can find more information on what options are available on the ViewHelpers rdoc page.

An alternative to will_paginate which you might also consider is Kaminari. It was recently covered in RailsCast 254

Good luck with your project.

like image 180
samullen Avatar answered Mar 24 '26 08:03

samullen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!