This project is archived and is in readonly mode.

#4469 ✓invalid
Hongli Lai

Accessing ActiveRecord::ConnectionAdapters::AbstractAdapter from console raises exception

Reported by Hongli Lai | April 24th, 2010 @ 01:59 PM

This is a new, empty Rails 3 app. My database.yml looks like this:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

Accessing ActiveRecord::ConnectionAdapters::AbstractAdapter causes it to autoload abstract_adapter.rb, which in turn requires connection_specification.rb. That file then raises an exception for some reason.

[hongli@Minato rails3.test]$ ./script/rails console
Loading development environment (Rails 3.0.0.beta3)
irb(main):001:0> ActiveRecord::ConnectionAdapters::AbstractAdapter
NameError: undefined local variable or method `establish_connection' for ActiveRecord::Base:Class
        from /Users/hongli/Projects/rails/activerecord/lib/active_record/base.rb:1141:in `method_missing'
        from /Users/hongli/Projects/rails/activerecord/lib/active_record/railtie.rb:49
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/lazy_load_hooks.rb:14:in `instance_eval'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/lazy_load_hooks.rb:14:in `run_load_hooks'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/lazy_load_hooks.rb:14:in `each'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/lazy_load_hooks.rb:14:in `run_load_hooks'
        from /Users/hongli/Projects/rails/activerecord/lib/active_record/base.rb:2250
        from /Users/hongli/Projects/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:2
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:209:in `require'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:209:in `require'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:195:in `load_dependency'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:523:in `new_constants_in'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:195:in `load_dependency'
        from /Users/hongli/Projects/rails/activesupport/lib/active_support/dependencies.rb:209:in `require'
        from /Users/hongli/Projects/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:12
        from (irb):1

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages