How to paginate in descending order?


#1

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


#2

:order => “created_on DESC”

The key is the “DESC” piece.


#3

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 :slight_smile:

Jeff


#4

Not a problem - glad to help.