Mongoid pagination

后端 未结 8 709
無奈伤痛
無奈伤痛 2021-02-05 12:01

I tried

@posts = Post.page(params[:page]).per_page(10)

and

@posts = Post.paginate(:page => 1, :per_page => 10)    
         


        
8条回答
  •  遇见更好的自我
    2021-02-05 12:39

    Posting several years later, in case someone else faces the same challenge.

    kaminari-mongoid was released in 2016, and is currently maintained.

    https://github.com/kaminari/kaminari-mongoid

    All the goodness of Kaminiari for Mongoid, including appropriate handling of Mongoid::Criteria results, which was possibly the cause of the OP's error.

提交回复
热议问题