mislav / will_paginate

Pagination library for Rails and other Ruby applications
http://github.com/mislav/will_paginate/wikis
MIT License
5.71k stars 864 forks source link

Set custom total_pages value #616

Closed Halvanhelv closed 3 years ago

Halvanhelv commented 4 years ago

Hi, I take the total number of pages from the external api, how to use these values ​​for pagination, because I have an undefined method total_pages error

mislav commented 3 years ago

You can pass :total_entries to the paginate() method on the model:

MyMode.paginate(page: 1, per_page: 10, total_entries: 50) #=> total_pages will now be 5