我试图让我的 mysql 测试数据库设置并有一个奇怪的错误,这些是我的配置
宝石文件
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem "mysql2"
# 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', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
group :test, :development do
gem "rspec-rails", "~> 2.0"
gem 'database_cleaner'
gem 'capybara'
gem "factory_girl_rails", ">= 4.1.0"
gem 'cucumber-rails', :require => false
gem 'mocha'
gem "shoulda-matchers"
gem "spork"
gem 'guard-rspec'
gem "guard-spork"
gem 'rb-inotify', '~> 0.8.8'
gem 'cucumber-rails', :require => false
gem 'cucumber-rails-training-wheels' #Still running on 'L' board
end
gem 'jquery-rails'
gem "twitter-bootstrap-rails"
gem "therubyracer", '0.10.2'
gem "less-rails"
gem 'devise'
gem 'omniauth-google-oauth2'
gem 'cancan'
# To use debugger
gem 'debugger'
gem 'ruby-prof'
我的 database.yml 文件
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
username: root
password: root
host: localhost
database: bamboo_test
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
cucumber:
<<: *test
这是我得到的错误
[sameera@sameera bamboo]$ rake db:create:all
rake aborted!
can't convert nil into Hash
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/application/configuration.rb:115:in `database_configuration'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:25:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:create:all => db:load_config
(See full trace by running task with --trace)
[sameera@sameera bamboo]$ rake db:create:all --trace
** Invoke db:create:all (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
rake aborted!
can't convert nil into Hash
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:196:in `merge!'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:196:in `block in visit_Psych_Nodes_Mapping'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each_slice'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `visit_Psych_Nodes_Mapping'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/visitor.rb:7:in `accept'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16:in `accept'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:205:in `block in visit_Psych_Nodes_Mapping'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `each_slice'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:190:in `visit_Psych_Nodes_Mapping'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/visitor.rb:7:in `accept'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16:in `accept'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/nodes/node.rb:25:in `to_ruby'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:107:in `load'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/application/configuration.rb:115:in `database_configuration'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:25:in `block (2 levels) in <top (required)>'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:185:in `each'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/sameera/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/sameera/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => db:create:all => db:load_config
加载.yml
文件时出现错误,但文件对我来说似乎没问题。任何帮助,将不胜感激。