Finally implementing pagination for your acts_as_ferret search results is as easy as it should be (at least if you’re using aaf trunk, everybody else will have to wait for the soon-to-be-released 0.4.2):
@results = Model.find_with_ferret params[:query], :page => params[:page],
:per_page => 10
Acts_as_ferret’s SearchResults class now gives you all you need to implement a helper rendering your pagination links:
@results.page # => current page
@results.page_count # => total number of pages
@results.previous_page # => index of previous page or nil if on the first page
@results.next_page # => index of next page or nil if on the last page
Best of all, this even works when you combine your query with ActiveRecord conditions.
Hint: really lazy people install the will_paginate plugin and use it’s
will_paginate helper method to get their pagination links for free!