toboto 2008-9-5 15:37
《agile》中的paginate问题
本人新手,在学《Web开发敏捷之道那本书》,其中的paginate可以对列表数据轻松完成分页功能,觉得不错。
rails是1.2.6的。
我自己尝试了写一个小sample,发现其中的paginate不好用了,无论我点下一页或上一页,显示的总是第一页的内容,虽然页码没有出错。
我的代码非常简单,就是[code]def list
@agent_relationship_pages, @agent_relationships = paginate :agent_relationships, :per_page => 10
end[/code]如果使用[code]def list
@agent_relationship_pages, @agent_relationships = paginate :agent_relationships, :per_page => 10,:page => params[:page]
end[/code]会报错:Undefined method 'page'
这是为什么呢?