Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observers are empty and cannot disable (version 0.1.5) #83

Open
coding-brigadier opened this issue Jun 9, 2021 · 0 comments
Open

Observers are empty and cannot disable (version 0.1.5) #83

coding-brigadier opened this issue Jun 9, 2021 · 0 comments

Comments

@coding-brigadier
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant