0

我正在尝试从 rails 2.3 升级到 rails 3,并且已经完成了 的事情清单rake rails:upgrade:check,但是,当我尝试启动我的 rails 控制台时,当我尝试访问任何表时出现以下错误:

irb(main):010:0> Game.all
ActiveRecord::ConnectionNotEstablished: ActiveRecord::ConnectionNotEstablished
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in `retrieve_connection'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:602:in `quoted_table_name'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/relation/query_methods.rb:275:in `build_select'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/relation/query_methods.rb:189:in `build_arel'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/relation/query_methods.rb:149:in `arel'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/relation.rb:64:in `to_a'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/relation/finder_methods.rb:143:in `all'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:444:in `all'
    from (irb):10
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.0.20/lib/rails/commands/console.rb:44:in `start'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.0.20/lib/rails/commands/console.rb:8:in `start'
    from /Users/ttt/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.0.20/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我正在使用 mysql,从 mysql2 gem 升级,我的 gem 文件看起来像:

gem "rails", "3.0.20"
gem 'mysql2', '~> 0.2.17'

我也更新了我database.yml

development_default: &development_default
  adapter: mysql2
  encoding: utf8
  reconnect: false
  pool: 5
  socket: /tmp/mysql.sock

development:
  <<: *development_default
  database: some_database
  username: some_user
  password: some_password
  host: some.domain.com
  port: 4000

我能够切换回我的 rails 2 分支并正常运行代码,所以这肯定与我的升级代码有关。任何指针是什么问题或下一步看哪里?

4

0 回答 0