rails/rails — pull request #6230 by spectator (2012-05-09 18:07:30+00:00)
Title: ActiveResource::TimeoutError is not loaded

Hi there,

Upgrading Rails 2.3 application to Rails 3 I run into issue where `ActiveResource::TimeoutError` doesn't load when application starts.

This is the vanilla Rails app to reproduce this issue https://github.com/spectator/rails_activeresource_exception

Given this line in a controller
```ruby
rescue_from ActiveResource::TimeoutError, :with => :service_error
```
application fails to start with `uninitialized constant ActiveResource::TimeoutError` unless `ActiveResource::Base` is explicitly called.

For example (rails console):
```shell
Loading development environment (Rails 3.2.3)
1.9.3p194 :001 > ActiveResource::TimeoutError
NameError: uninitialized constant ActiveResource::TimeoutError
from (irb):1
from /Users/spectator/.rvm/gems/ruby-1.9.3-p194@rails_activeresource_exception/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
from /Users/spectator/.rvm/gems/ruby-1.9.3-p194@rails_activeresource_exception/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
from /Users/spectator/.rvm/gems/ruby-1.9.3-p194@rails_activeresource_exception/gems/railties-3.2.3/lib/rails/commands.rb:41:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
1.9.3p194 :002 > ActiveResource::Base
=> ActiveResource::Base
1.9.3p194 :003 > ActiveResource::TimeoutError
=> ActiveResource::TimeoutError
```

Autoloading this constant helps to solve this issue.

Submitting to 3-2-stable, because `ActiveResource` is gone in master. All tests pass.