[英]Pagination in Rails controller using Kaminari
I'm using Kaminari for some pagination but getting the following error when trying to see my index action: 我正在使用Kaminari进行分页,但是在尝试查看索引操作时收到以下错误:
undefined method `to_i' for {:page=>1}:Hash {:page => 1}的不确定方法`to_i':哈希
The controllers index action is: 控制器索引操作为:
def index
respond_to do |format|
format.html do
@coasters = Coaster.scoped.page(page: (params[:page] || 1))
end
end
end
Any ideas? 有任何想法吗?
page
需要一个整数或一个响应to_i
作为参数的对象。
@coasters = Coaster.scoped.page(params[:page] || 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.