Hello.
I’ve been trying to get multi_search to work and I simply can’t.
I have two models:
Post
acts_as_ferret :fields => [:title, :body], :store_class_name => true
Page
acts_as_ferret :fields => [:title, :body], :store_class_name => true
If I do @results = Post.find_by_contents(params[:q]) or @results =
Page.find_by_contents(params[:q]) it works fine, but if I try to search
in both models @results = Page.multi_search(params[:q],[Post]) I get the
following error:
nil is not a symbol
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:438:in
const_get' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:438:in
multi_search’
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:460:in
id_multi_search' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/multi_index.rb:28:in
search_each’
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/multi_index.rb:28:in
search_each' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:457:in
id_multi_search’
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:437:in
multi_search' #{RAILS_ROOT}/app/controllers/site_controller.rb:121:in
search’
-e:3:in `load’
-e:3
The interesting part is that this only happens whenever it also finds a
Page that maches the query. If it only finds Posts there’s no errors.
Post is part of a has many through relation so my guess is that this
could something to do with it but don’t know what.
The indexes are ok for both models.
I’m using ferret-0.10.9-mswin32 and the latest version of the
acts_as_ferret plugin.
Any help would be greatly appreciated!