LoadErrors raised from Ruby on Rails' ActiveSupport may look something like:
/usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:426:in `load_missing_constant':
Expected /path/to/the/rails/root/app/models/bacon.rb to define Bacon (LoadError)
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:80:in `const_missing'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:92:in `const_missing'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:437:in `load_missing_constant'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:80:in `const_missing'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:437:in `load_missing_constant'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:80:in `const_missing'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:437:in `load_missing_constant'
from /usr/local/lib/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:80:in `const_missing'
... 26 levels...
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/local/bin/irb:13
The folded/clipped/omitted middle of the stack trace leads to a very frustrating debugging experience.
To expand the backtrace & see the full stack, load the application environment manually in irb with a liberal trace limit:
% cd /path/to/the/rails/root
% export RAILS_ENV=development
% irb --back-trace-limit 1000
irb(main):001:0> require 'config/boot.rb'
irb(main):002:0> require 'config/environment.rb'
You will hopefully see the exception raised + the complete stack trace.
Leave a Reply