Hi people!
I’m a newbie in Ferret, writing from Uruguay
I found that acts_as_ferret is an excellent tool and I make it worked
with simple queries (with just 1 model).
But, I found problems when I tried to use it with multiple models. Here
I show how I use it, maybe I misunderstood something…
I have 2 modeles models that I want to search on: Article and NewsItem.
article.rb
require ‘acts_as_ferret’
class Article < ActiveRecord::Base
…
acts_as_ferret :store_class_name => true
…
end
news_item.rb
require ‘acts_as_ferret’
class NewsItem < ActiveRecord::Base
…
acts_as_ferret :store_class_name => true
…
end
Then when I want to make use of find_with_ferret in my controller, the
code looks like this:
class SearchResultController < ApplicationController
def index
unless params[:q].blank?
params[:page] = 1 unless params[:page]
@collection = Article.find_with_ferret params[:q], :page =>
params[:page], :per_page => 1, :multi => [ NewsItem ]
else
flash[:notice] = “Please provide a search query”
redirect_to root_path
end
end
end
Everything looks fine at this point… but, as I mentioned this code
doesn’t work, and the error that controller displays is the following:
RuntimeError in Search resultController#index
‘:store_class_name => true’ required for multi_search to work
Any thoughts?, Any comment would make the difference
Thank you very much!
marcelo