Hi !
2007/4/4, Jens Kraemer <[EMAIL PROTECTED]>:
> As I think of it now, the way how this is done might not be the ideal
> solution to the problem of deciding whether acts_as_ferret is called in
> the DRb-server or not - an environment variable set when
> starting the server and checking this in act_methods.rb instead of the
> server's running method might help:
I changed Ferret's implementation with this patch:
$ svn diff vendor/plugins
Index: vendor/plugins/acts_as_ferret/lib/ferret_server.rb
===================================================================
--- vendor/plugins/acts_as_ferret/lib/ferret_server.rb (revision 4125)
+++ vendor/plugins/acts_as_ferret/lib/ferret_server.rb (working copy)
@@ -63,9 +63,9 @@
# TODO: rebuild indexes in separate directory so no lock errors in these
# cases.
def method_missing(name, *args)
+ @logger.debug "\#method_missing(#{name.inspect}, #{args.inspect})"
clazz = args.shift.constantize
begin
- @logger.debug "call index method: #{name} with #{args.inspect}"
clazz.aaf_index.send name, *args
rescue NoMethodError
@logger.debug "no luck, trying to call class method instead"
Index: vendor/plugins/acts_as_ferret/lib/act_methods.rb
===================================================================
--- vendor/plugins/acts_as_ferret/lib/act_methods.rb (revision 4125)
+++ vendor/plugins/acts_as_ferret/lib/act_methods.rb (working copy)
@@ -59,11 +59,15 @@
# force local mode if running *inside* the Ferret server - somewhere the
# real indexing has to be done after all :-)
- options.delete(:remote) if ActsAsFerret::Remote::Server.running
+ logger.debug {"Asked for a remote server ?
#{options[:remote].inspect}, ENV[\"FERRET_USE_LOCAL_INDEX\"] is
#{ENV["FERRET_USE_LOCAL_INDEX"].inspect}, server is
#{ActsAsFerret::Remote::Server.running ? :running : :not_running}"}
+ options.delete(:remote) if ENV["FERRET_USE_LOCAL_INDEX"] ||
ActsAsFerret::Remote::Server.running
if options[:remote] && options[:remote] !~ /^druby/
# read server location from config/ferret_server.yml
options[:remote] =
ActsAsFerret::Remote::Config.load("#{RAILS_ROOT}/config/ferret_server.yml")[:uri]
+ logger.debug {"Will use a remote index server which should be
available at #{options[:remote]}"}
+ else
+ logger.debug {"Will use a local index"}
end
That resolved my problem when I start the DRb server using:
$ FERRET_USE_LOCAL_INDEX=1 script/runner -e development
vendor/plugins/acts_as_ferret/script/ferret_start
BTW, my models are loaded because I have AR observers.
Thanks !
--
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk