will_paginate
Show archive.org snapshot
triggers a database query to determine the total number of entries (i.e. to let you display the number of search results). When you paginate complex scope (e.g. that has many include
s), this query may take several seconds to complete.
If you encounter this behavior, a solution is to calculate the total count yourself and pass it to the pagination call:
scope = User.complex_scope_full_of_includes
total_number_of_users = scope.count
@users = scope.paginate(:total_entries => total_number_of_users)
Posted by Dominik Schöler to makandra dev (2012-02-23 14:36)