Is there any way to force will_paginate plugin to use counter_cache instead of using
SELECT count(*) query? I’ve heard that Model.count is using by default counter caches. So will_paginate must use size method. How I can change the way it gathers amount of objects to be paginated?
Is there any way to force will_paginate plugin to use counter_cache instead of using
Share
Assuming two models,
AuthorandComment, whereAuthorhas_manyComments using counter cache, you should be able to pass an option:total_entriesto thepaginate-method like this:See more here: https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/active_record.rb#L128