我有一个使用 mysql 的 rails 项目(过去非常成功)。但是,在升级我的 postgres 安装后,这个 rails 项目抛出未安装适配器的错误:
/Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
我的database.yml
文件正确地将适配器声明为mysql2
.
我尝试按照建议安装 activerecord-postgresql-adapter gem(但没有将其添加到我的 gemfile 中,因为我没有使用 postgres),但这并没有解决问题。
我仍然能够登录到我机器上的 mysql 服务器并验证数据库及其表是否存在。
stacktrace 确实显示 rails 正在尝试使用 postgres 适配器,但我在项目中的任何地方都没有指示使用 postgres。
from /Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@mfacs/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:7:in `<top (required)>'
from /Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@mfacs/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@mfacs/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@mfacs/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/stuartnelson/.rvm/gems/ruby-1.9.3-p448@mfacs/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
不知何故,我的 postgres 安装引起了这个(我认为)。有没有人有这方面的经验以及如何解决它?