Problem with scope_out and acts_as_ferret

Hi!

We have a problem when using scope_out plugin and acts_as_ferret in
Rails 2.0.

When we’re using both plugins we get an error when trying to rebuild
index or starting the server

(druby://localhost:9010)
/vendor/plugins/scope_out/lib/scope_out.rb:70:in method_missing': undefined methodaaf_configuration’ for #Class:0x251b3bc
(NoMethodError)
from (druby://localhost:9010)
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
method_missing' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:120:inensure_index_exists’
from (druby://localhost:9010)
/vendor/plugins/acts_as_ferret/lib/ferret_server.rb:164:in with_class' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:119:inensure_index_exists’
from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in
send' from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:inmethod_missing’
from /vendor/plugins/acts_as_ferret/lib/act_methods.rb:189:in
`acts_as_ferret’
from /app/models/post.rb:17
… 60 levels…

Did anybody have the same problems and did already solve this?

Tobi

I am having the same problem now, with our production rails (1.2.6)
server, however, I am not using the scope_out plugin.

My plugins: acts_as_ferret broomstick comatose exception_notification
recaptcha restful_authentication routing_tricks rspec rspec_autotest
rspec_on_rails spawn

I get the following error when trying to start a rails instance or a
console with my acts_as_ferret line in my model.

(druby://localhost:9010)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1238:in
method_missing':NoMethodError: undefined methodaaf_configuration’ for
Article:Class

At first I thought it was an index problem but this seems like something
is getting loaded in the wrong order. Our environment was pretty stable
and our plugins haven’t changed at all so I’m having a hard time trying
to track down the problem.

Here’s my ferret hook in my class:
STOP_WORDS = []
acts_as_ferret(
{ :fields => {:title_text =>{:store=>:yes},:authors_text
=>{:store=>:yes}, :volume =>{:store=>:yes}, :year =>{:store=>:yes},
:fpage =>{:store=>:yes}, :abstract_text=>{:store=>:yes},:article_text =>
{:store=>:yes}, :issue => {:store=>:yes}, :pub_date_sort => {:index =>
:untokenized}}},
{:analyzer => Ferret::Analysis::StandardAnalyzer.new(STOP_WORDS)})

Were you able to find a solution? Did you have to remove that plugin?

Shawn

Tobias Reike wrote:

Hi!

We have a problem when using scope_out plugin and acts_as_ferret in
Rails 2.0.

When we’re using both plugins we get an error when trying to rebuild
index or starting the server

(druby://localhost:9010)
/vendor/plugins/scope_out/lib/scope_out.rb:70:in method_missing': undefined methodaaf_configuration’ for #Class:0x251b3bc
(NoMethodError)
from (druby://localhost:9010)
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
method_missing' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:120:inensure_index_exists’
from (druby://localhost:9010)
/vendor/plugins/acts_as_ferret/lib/ferret_server.rb:164:in with_class' from (druby://localhost:9010) /vendor/plugins/acts_as_ferret/lib/ferret_server.rb:119:inensure_index_exists’
from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in
send' from /vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:inmethod_missing’
from /vendor/plugins/acts_as_ferret/lib/act_methods.rb:189:in
`acts_as_ferret’
from /app/models/post.rb:17
… 60 levels…

Did anybody have the same problems and did already solve this?

Tobi

Looks like this is more user error than anything. After scratching my
head for about 4 days, I found that the ferret server needs to know
which models are tied to it through the acts_as_ferret declaration,
which is done by specifying the root (-R) parameter.

The script/ferret_server must be started with the environment and the
root parameters. The root parameter (-R) serves 2 purposes. One, it
tells ferret where the index files reside (RAILS_ROOT/index) and where
the models are (RAILS_ROOT/app/models). Apparently, ferret needs access
to the models. I found this out when I started a console instance from a
different project checked out where the acts_as_ferret line in my model
was active and the ferret server was started in a different directory
where the acts_as_ferret line was commented out. The console returned
this error:
(druby://localhost:9010)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/base.rb:1238:in
method_missing':NoMethodError: undefined methodaaf_configuration’ for Article:Class

Secondly, if the root parameter is absent, it will look to the 

current directory and try to build the indexes there.

To sum this up, the ferret server depends on the rails project and 

index files; the rails project depends on a started ferret server (when
acts_as_ferret is used). Multiple instances of rails accessing the same
ferret server should have the exact same models with the same
acts_as_ferret hooks.

This probably a bit obvious but I felt obliged to post for those
less-obvious types like myself. :wink:

Shawn