Rails 3: Model.all => NoMethodError: undefined method 'accept' for nil:NilClass

后端 未结 2 950
滥情空心
滥情空心 2021-01-18 21:41

I\'m trying to build a Rails app around a pre-existing MySQL database. I created the rails project, set up the database.yml file properly and created one model, User, to cor

2条回答
  •  粉色の甜心
    2021-01-18 22:31

    I had similar problem with MySQL after upgrading to rails 3.2.2.

    This is what I did to fix it.

    rvm gem install mysql2
    In GemFile remove old MySQL gem and add - gem ‘mysql2' 
    bundle install
    bundle update activerecord-mysql2-adapter
    bundle update mysql2
    

    then restart your rails server.

提交回复
热议问题