Ahh, after some investigation, I found that starting the ferret server 
puts the following in the Rails log:

Asked for a remote server ? true, ENV["FERRET_USE_LOCAL_INDEX"] is nil, 
server is not_running
Will use remote index server which should be available at 
druby://127.0.0.1:9010

Which was only vaguely suspicious, but then the code revealed:

# Usually the automatic detection of server mode works fine, however if 
you
# require your model classes in environment.rb they will get loaded 
before the
# DRb server is started, so this code is executed too early and 
detection won't
# work. In this case you'll get endless loops resulting in "stack level 
too deep"
# errors.
# To get around this, start the server with the environment variable
# FERRET_USE_LOCAL_INDEX set to '1'.

Now the comments claim that we would get "stack level too deep" but 
because RemoteIndex::add modifies the argument with a to_doc, we 
actually get a NoMethodError from the second call to to_doc:

undefined method `to_doc' for {"firstname"=>"Seggy", 
"lastname"=>"Umboh", :id=>1}:Ferret::Document

This effectively cuts the infinite loop, and avoids the "stack level too 
deep" error.

So, the solution, at least in my case, is to run the server with:

FERRET_USE_LOCAL_INDEX=1 script/ferret_start

Hope that helps...

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to