Expected X to define Y error
I just got hit by this famous error again. And I am not the only one:
- Aug 2006: Expected … to define …
- Dec 2006: Weird error trying to define controller?
- Jan 2007: rails 1.2.1
- Ticket #7452 (there are more)
- Google search on this error message
Now, I know I should put my patches where my mouth is. And that’s exactly what I’m trying to do here. My application is on the 1.2 branch, and I get this error if I have the Response Logger plugin loaded. Trying again with Edge Rails, I again get the error. If I try with WEBrick or Mongrel, same error. Loading the console produces the same error. Using Windows or Linux changes nothing: same error.
The exact backtrace is:
1 $ ruby script\console
2 Loading development environment.
3 ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:249:in `load_missing_constant’: Expected ./script/../config/../config/../vendor/plugins/response_logger/lib/response_logger.rb to define ResponseLogger (LoadError)
4 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing’
5 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:464:in `const_missing’
6 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant’
7 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing’
8 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant’
9 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing’
10 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant’
11 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing’
12 … 14 levels…
13 from C:/ruby/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
14 from C:/ruby/lib/ruby/1.8/irb/init.rb:21:in `setup’
15 from C:/ruby/lib/ruby/1.8/irb.rb:54:in `start’
16 from C:/ruby/bin/irb.bat:20
In this application, I am using Engines, along with LoginEngine. You really need the right version of Engines with the right version of Rails for things to work out well: Rails 1.2 requires Engines 1.2.