EDIT Looks like I figured it out – I had to call paginate after the call to
all from Searchlogic.
I'm trying to use both of these tools to enable users to search contacts and return a paginated list (or the entire paginated list if they don't enter any search criteria). However I'm unsure of the proper way to chain them together, and what I'm trying is giving me errors.
Here is my controller:
class ContactsController < ApplicationController def index @search = Contact.search(params[:search]).paginate(:page => params[:page]) @contacts, @contacts_count = @search.all, @search.count end end
This gives me the error
Undefined method 'all' for WillPaginate. Removing the all gives me an error because the view is looking for a path that has the word "contact" 20 times (e.g.
contact_contact_contact..._path), presumably because the default "per page" is 20.
What am I doing wrong? I would like to have searching, ordering and pagination all on this page.