Currently the posts are filtered by: Development
Reset this filter to see all posts.

Category: Ruby on Rails
Date: 2010-07-27 15:29

Rails will_paginate with acts_as_ferret

I wanted to use pagination in one of my Rails projects where I was also using the acts_as_ferret plugin. Now normally one would use

@collection=Model.paginate(:page=>params[:page])

in the controller and in the view render with:

<%= will_paginate @collection %>

But with acts_as_ferret the controller will contain:

@collection=Model.find_with_ferret(params[:search], {:page=> params[:page], :per_page=>Model.per_page})

This is not a problem however. Acts_as_ferret is compatible with will_paginate. Your default will_paginate() helper will still be working.