Forum: Ruby on Rails How to paginate in descending order?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff C. (Guest)
on 2006-03-16 14:28
How can I paginate a set of fields in descending order based on their
created_on date?

For example, in a blog app, you want the very first entry on the first
page to be the most recent.

I see that paginate has an :order parameter, but I don't see any way of
changing the direction of the order.

Thanks,
Jeff C.man
Michael G. (Guest)
on 2006-03-16 14:34
(Received via mailing list)
:order => "created_on DESC"

The key is the "DESC" piece.
Jeff C. (Guest)
on 2006-03-16 14:36
Michael G. wrote:
> :order => "created_on DESC"
>
> The key is the "DESC" piece.

Thanks!  I'm a bit of a SQL new as well as ROR one :)

Jeff
Michael G. (Guest)
on 2006-03-16 15:42
(Received via mailing list)
Not a problem - glad to help.
This topic is locked and can not be replied to.