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 Coleman -- Posted via http://www.ruby-forum.com/.
:order => "created_on DESC" The key is the "DESC" piece. On 3/16/06, Jeff Coleman <progressions@gmail.com> wrote:> > 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 Coleman > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Michael Gorsuch 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 -- Posted via http://www.ruby-forum.com/.
Not a problem - glad to help. On 3/16/06, Jeff Coleman <progressions@gmail.com> wrote:> > Michael Gorsuch 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060316/ad7fd3c5/attachment.html