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

Setting config.active_record.observers breaks loading Rails environment #6320

Closed
esposito opened this issue May 15, 2012 · 3 comments
Closed

Comments

@esposito
Copy link

When I use an observer in my Rails app, loading the Rails environment does not work properly any more. The most simple way to reproduce this error is by cloning my repository:

git clone git://github.com/krikis/nomad.git
cd nomad
git checkout observer_load_error

and running

rails r "puts Post"

You should get an exception like:

/path/to/homedir/.rvm/gems/ruby-1.9.3-p125-perf@rails32/gems/railties-3.2.1/lib/rails/commands/runner.rb:53:in `eval': Expected /path/to/rails_app/app/models/post.rb to define Post (LoadError)

When I comment line 27 in my config/application.rb

config.active_record.observers = :post_observer

the code runs fine.

I ran into this issue using Rails 3.2.1

@kennyj
Copy link
Contributor

kennyj commented May 15, 2012

I think that this is same to #4045.
I send a patch, but it had side effect, and it is reverted.

@rafaelfranca
Copy link
Member

Please try to upgrade to 3.2.3 or 3-2-stable and see if it was fixed. I think we already fixed this bug.

@rafaelfranca
Copy link
Member

I remember now. @kennyj thanks to explain. I'll close this issue now since #4045 have more information.

Please follow that issue.

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

3 participants