When I pass will_paginate ActiveRelation, it always calls its #count method and gets into the database to find out the total number of elements. But this operation takes time, and my total number is already cached and ready. Can I pass this pre-calculated counter to will_paginate and stop it from getting into the database?
I tried the parameter :count , but it was passed to ActiveRecord as an option:
active_relation.paginate(page: 2, per_page: 100, count: total_count)
Thanks!:)
source share