mislav / will_paginate

Pagination library for Rails and other Ruby applications

Home Page:http://github.com/mislav/will_paginate/wikis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set custom total_pages value

Halvanhelv opened this issue · comments

commented

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

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