rails/rails-observers

Observers are empty and cannot disable (version 0.1.5)

coding-brigadier opened this issue · 0 comments

Hi all,

I need to make call while disabling one of the observers, but there is something I have noticed. Due to some sensitive information, I'll replace the names of classes. For the purpose of this issue, I am using Rails 4.2.11 and rails-observer 0.1.5.

I've tried all of these on the rails console:

  • ActiveRecord::Base.observers returns all of the observers I have defined in config.active_record.observers.
  • Foo.observers returns an empty array, even though I do have FooObserver and it's in config.active_record.observers. I even checked to make sure ActiveRecord::Base.observers has foo_observer which appears to be the case.
  • So I then tried to disable by calling ActiveRecord::Base.observers.disable :foo_observer, but got the following output:
=> [PgSearch::Document(Table doesn't exist),
 ApplicationRecord(abstract),
 ... the rest may be irrelevant, since it's all model definitions. Interestingly enough, I don't see the model Foo in the list, even though it does exist and I can invoke it...
 ]

I hope this is enough information and hope someone has a good solution on how I can get around it.