一旦我输入rake db:migrate我收到此消息
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
rake aborted!
NoMethodError: undefined method `accept' for nil:NilClass
C:3:in `rescue in map'
C:-1:in `map'
NoMethodError: undefined method `accept' for nil:NilClass
C:-1:in `map'
Tasks: TOP => db:migrate
以下是我的GemFile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use mysql as the database for Active Record
gem 'mysql2'
gem 'activerecord-mysql2-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
以下是我的database.yml
development:
adapter: mysql2
encoding: utf8
database: test_app_development
pool: 5
username: root
password: password
host: localhost
在将activerecord-mysql2-adapter添加到我的gem文件之前,我收到了这个错误:active record :: conecction not established webbrick
但是在我添加了这个gem之后它很好(这是在创建数据库之前完成的)。网上有很多论坛表明这个gem是我问题的根源,现在我在创建数据库后删除它时出现以下错误:指定' mysql2'对于数据库适配器,但未加载gem。将gem 'mysql2'
添加到您的Gemfile。
我在windows上运行ruby 2.3.0上的rails 4.0.0 非常感谢您的帮助
答案 0 :(得分:0)
就像你提到的那样,很可能这是一个包含gem 'activerecord-mysql2-adapter
从Gemfile中删除它,运行bundle update
,然后重新启动服务器。如果您仍然收到错误,请在此处发布。