Erik Morton
2007-Sep-12 17:37 UTC
[Ferret-talk] Can''t disable ferret when running in Mongrel
In my environment.rb I say the following: MyModel.disable_ferret puts MyModel.ferret_enabled? The console works as expected: script/console false >> MyModel.ferret_enabled? => false I can then edit an instance, ferret remains disabled and the changes are not immediately indexed. However, when I start mongrel Ferret is initially disabled, but then somehow becomes enabled again after the first request. I don''t explicitly enable ferret anywhere. Here is my ferret config for the model in question: acts_as_ferret( { :remote => true, :index_dir => "#{AAF_INDEX}/ supplier", :fields => { :supplier => { :store => :yes }, :name => {:store => :yes}, :private_description => {}, :title => {}, :ur l => { :store => :yes }, :description => { :boost => 10.0 }, :su pplier_id => { :store => :yes }, :supplier_name => { :boost => 10.0 }, :ke ywords => { :boost => 10.0 }, :data => {}, :extract => {}, :city => {}, :st ate => {} } } ) Does anyone have any idea what could reenable ferret? Thanks, Erik
Jens Kraemer
2007-Sep-12 18:10 UTC
[Ferret-talk] Can''t disable ferret when running in Mongrel
On Wed, Sep 12, 2007 at 01:37:55PM -0400, Erik Morton wrote:> In my environment.rb I say the following: > > MyModel.disable_ferret > puts MyModel.ferret_enabled? > > The console works as expected: > > script/console > false > >> MyModel.ferret_enabled? > => false > > I can then edit an instance, ferret remains disabled and the changes > are not immediately indexed. > > However, when I start mongrel Ferret is initially disabled, but then > somehow becomes enabled again after the first request. I don''t > explicitly enable ferret anywhere.is this happening in development or production mode? This might be an issue with the class reloading done in development mode, where the class is reloaded, but environment.rb isn''t parsed again. Cheers, Jens -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database
Erik Morton
2007-Sep-12 19:14 UTC
[Ferret-talk] Can''t disable ferret when running in Mongrel
That was the problem. Sounds obvious now. Thanks again. Erik On Sep 12, 2007, at 2:10 PM, Jens Kraemer wrote:> On Wed, Sep 12, 2007 at 01:37:55PM -0400, Erik Morton wrote: >> In my environment.rb I say the following: >> >> MyModel.disable_ferret >> puts MyModel.ferret_enabled? >> >> The console works as expected: >> >> script/console >> false >>>> MyModel.ferret_enabled? >> => false >> >> I can then edit an instance, ferret remains disabled and the changes >> are not immediately indexed. >> >> However, when I start mongrel Ferret is initially disabled, but then >> somehow becomes enabled again after the first request. I don''t >> explicitly enable ferret anywhere. > > is this happening in development or production mode? This might be an > issue with the class reloading done in development mode, where the > class > is reloaded, but environment.rb isn''t parsed again. > > Cheers, > Jens > > -- > Jens Kr?mer > http://www.jkraemer.net/ - Blog > http://www.omdb.org/ - The new free film database > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk
Jens Kraemer
2007-Sep-12 19:45 UTC
[Ferret-talk] Can''t disable ferret when running in Mongrel
On Wed, Sep 12, 2007 at 03:14:21PM -0400, Erik Morton wrote:> That was the problem. Sounds obvious now. Thanks again.Ok. Now how do you deal with this? I''d probably do something like this in application.rb: before_filter :disable_ferret if RAILS_ENV == ''development'' def disable_ferret MyModel.disable_ferret end Not nice but should do until aaf gets a proper config mechanism that allows setting variables in environment.rb that are read whenever acts_as_ferret is called. While I think of it - maybe a simple :readonly => true switch for the acts_as_ferret method would be even more straightforward instead of calling MyModel.disable_ferret in environment.rb? Cheers, Jens -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database