title: Ordering a results set with pagination using will_paginate
body: <p>I'm using <a href="https://github.com/mislav/will_paginate" rel="nofollow">will_paginate</a> for pagination in a Rails 3 site. I'd like to be able to click on the table headers (e.g. "name", "created at") for each of the output fields and have the results ordered on that field. It would also be nice to be able to click again for reverse ordering. Is there something that works well with will_paginate for ordering? Can I do this just using will_paginate?</p>
  
  <p>The table format I'm using is pretty generic:</p>
  
  <pre><code>&lt;%= will_paginate %&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;ID&lt;/th&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Updated&lt;/th&gt;
      &lt;/tr&gt;   
      &lt;% @shops.each do |shop| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= shop.id %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= shop.name %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= shop.updated_at.strftime("%a %b %d %H:%M ") %&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;% end %&gt;
  &lt;/table&gt;
  &lt;%= will_paginate %&gt;
  </code></pre>