Tuesday, February 07, 2006

Rails Paginate DESC and notes

One way to specify the order:

@article_pages, @articles = paginate :articles, :order_by=> "created_at DESC", :per_page => 10


Reverse the list

for post in posts.reverse



Take everything within

for article in articles

and put it in _article.rhtml. Then replace the remaining "for" block with this line:

<%= render :partial => "article", :collection => @articles %>

We can place the above line in show.rhtml or whereever we like.

0 Comments:

Post a Comment

<< Home

eXTReMe Tracker