I am using rails 3.2. I am paginating my results using .page(1).per_page(10)
like
@users = User.method().page(1).per_page(10)
Now how to find the total count of the users from the pagination
As because @users.count
gives 10 from the first page and not the total count
How to get the total count of the users even after pagination
EDIT : @users.total_count
gives the whole paginated count
As mentioned in the question, you can get the total count of the records with
@users.total_count
I've added this as an answer for the sake of completeness.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With