Mongoid pagination

Vyacheslav Loginov picture Vyacheslav Loginov · Dec 18, 2011 · Viewed 11.1k times · Source

I tried

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

and

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

but neither method works

undefined method `page' for Post:Class

undefined method `paginate' for Post:Class

How do you do pagination with mongoid?

Answer

Vyacheslav Loginov picture Vyacheslav Loginov · Dec 21, 2011

You should use Kaminari https://github.com/amatsuda/kaminari