2

有什么简单的方法可以用 反转页面编号will_paginate吗?

我希望首页(最后一次)为#1,最后一页(最早)为#N。

原因是页面内容不应该随着时间而改变,这对 SEO 是有利的。

4

2 回答 2

4

按升序而不是降序对查询进行排序

def index
  @posts = Post.paginate :page => params[:page], :order => "created_at ASC"
end
于 2010-01-29T16:30:31.107 回答
0

I'm not sure I understand. If the oldest content is #N, then when there's new content, the oldest content will be pushed to #N+1 and the page contents would change. That sounds like it's the opposite of what you're looking for?

You can pass :order => "column ASC" or :order => "column DESC" to paginate to determine what ends up on page #1.

于 2010-01-29T16:29:24.323 回答