我已将 rails2 升级到 rails3,当我尝试 rake db:migrate 时发现以下错误
`rake aborted!`
undefined method `mysql_connection' for ActiveRecord::Base:Class
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:55:in `method_missing'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:153:in `select_connection'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:215:in `method_missing'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/migration.rb:662:in `initialize'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/migration.rb:570:in `new'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/migration.rb:570:in `up'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/migration.rb:117:in `up_with_octopus'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/migration.rb:551:in `migrate'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/migration.rb:111:in `block in migrate_with_octopus'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:171:in `run_queries_on_shard'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:180:in `block in send_queries_to_multiple_shards'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:179:in `each'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/proxy.rb:179:in `send_queries_to_multiple_shards'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/ar-octopus-0.6.1/lib/octopus/migration.rb:110:in `migrate_with_octopus'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/bin/ruby_executable_hooks:15:in `eval'
/home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)`
这是我的 database.yml 文件开发:
适配器:mysql2
数据库:db
用户名:root
密码:
套接字:/opt/lampp/var/mysql/mysql.sock