two very useful pieces of code related to will_paginate and acts_as_ferret
- Paginating with will_paginate _and_ ajax
- Paginating acts_as_ferret results
Lately, I’ve been developing an application with huge amounts of data. For this reason i couldn’t delay anymore the use of pagination on my views. I wanted to use will_paginate because it is such a nice plugin, but i was annoyed for it’s lack of support for ajax. The solution was quite simple, tough, because rails makes it so easy. I only had to change the link_to calls for link_to_remote calls. I was almost there when i decided to check the repository of will paginate. There, i found that a patch by Florent Piteau was already there resolving this very issue. So here you are:
or the complete source (just change view_helpers.rb for this one, or load this file on environment.rb):
Also, there is a patch to paginate ferret search results that is really easy to use. Here you are:
Note: I added the
bit to add compatibility with my previous api.