简体   繁体   中英

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:

undefined method `to_i' for {:page=>1}:Hash

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM