title: Getting total result count from Rails query using will_paginate
body: <p>I get a list of objects from my Rails app, and use will_paginate to page as usual, and then I have a little method used to save details of the search to the database:</p>
  
  <pre><code>per_page=10
  session[:search_params] = params[:search_people]
  @documents = Person.search_people(params[:search_people], params[:page], per_page)
  
  Search.create(:user_id     =&gt; (!current_user ? 0 : current_user.id),
     :search_type =&gt; "Person", 
     :firstname   =&gt; params[:search_people][:first_name], 
     :lastname    =&gt; params[:search_people][:last_name],
     :results     =&gt; @documents.count )
  </code></pre>
  
  <p>The problem is, the number of search results (@douments.count) is always &lt;= per_page used for will_paginate.  </p>
  
  <p>I understand why this is, but is there a way around it without running the query twice, once with will_paginate and once without?</p>