Is there an easy way, to default will_paginate to last page? I would like to show user latest addition and allow to browse previuos pages of results...
A:
Just order your query so that it's in reverse chronological order.
Post.paginate(:page => (params[:page] || 1), :per_page => 20 :order => "created_at desc")
Chris Heald
2010-08-28 10:36:54
+2
A:
The proper way to do it is to reverse the sorting order, i.e. add
:order => 'created_at DESC'
to your paginate call. User would expect the "latest addition" on the beginning, and older ones on the following pages.
qertoip
2010-08-28 10:39:42
It's not the solution. I need the chronological order, but I need to point user to the last page.
mdrozdziel
2010-08-29 10:03:51
A:
This solution was the most resonable idea I found:
http://groups.google.com/group/will_paginate/browse_thread/thread/63b8d295f25085c2
mdrozdziel
2010-08-30 12:27:49