I was using the current stable version of acts_as_ferret to develop
until I ran into the “Expected x to define Y” bug outlined in
http://projects.jkraemer.net/acts_as_ferret/ticket/191
This fixed the problem I was running into in production, however my
multi-model searches are only returning the main model and not any
associated models.
I’ve added this search method into acts_as_ferret:
module ActsAsFerret
module ClassMethods
def paginate_search(query, options = {})
page, per_page, total = wp_parse_options(options)
pager = WillPaginate::Collection.new(page, per_page, total)
options.merge!(:offset => pager.offset, :limit => per_page)
result = find_with_ferret(query, options)
returning WillPaginate::Collection.new(page, per_page,
result.total_hits) do |p|
p.replace result
end
end
end
end
Additionally, here’s the search query that I use:
@results = Customer.paginate_search(“#{@search_string}”,
:page => (params[:page] || 1),
:per_page => 10,
:multi => [Address, EmailAddress, PhoneNumber])
Any help would greatly be appreciated.
Thanks in advance,
jeremiah