我将首先给出我的规格:
- RVM 1.12.1
- 导轨 3.2.3
- Ruby 1.9.3p125(2012-02-16 修订版 34643)[x86_64-darwin12.0.0]
- RubyGem 1.8.21
- OS X 10.8 山狮
- Kenneth Reitz 的 OSX 10.7+ 的 GCC 安装程序,第 2 版(包括 X11 标头,错误修复)
我的 Gemfile 如下:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
我的 database.yml 是:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
当我启动服务器并转到默认主页并单击“查看环境”按钮时,我收到“ActiveRecord::ConnectionNotEstablished”错误。
当我检查控制台时,我看到:
/Users/username/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.) (LoadError)
from /Users/username/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/activerecord-3.2.3/lib/active_record/connection_adapters/mysql_adapter.rb:5:in `<top (required)>'
from /Users/username/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/username/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/username/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/username/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
尽管我使用的是 SQLite 并且在任何地方都没有引用 MySQL。这可能是某种使用 10.8 的副作用吗?我难住了!