简体   繁体   中英

Error after rake db:migrate command: rake aborted! NoMethodError: undefined method `accept' for nil:NilClass

Once i type rake db:migrate i receive this message

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

The following is my 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

and the following is my database.yml

development:
  adapter: mysql2
  encoding: utf8
  database: test_app_development
  pool: 5
  username: root
  password: password
  host: localhost

Before adding activerecord-mysql2-adapter to my gem files I got this error : active record::conecction not established webbrick but after i added that gem it was fine (This was done before creating a database). A lot of forums online indicate that this gem is the origin of my problem and now when i remove it after creating a database I get the following error : Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile.

I am running rails 4.0.0 on ruby 2.3.0 on windows Thanks a lot for your help

Like you mentioned, most likely this is a gem conflict from including gem 'activerecord-mysql2-adapter

Remove it from your Gemfile, run bundle update , then restart your server. If you still get an error, post it here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM