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

后端 未结 2 949
滥情空心
滥情空心 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:22

    Just had the same issue. Narrowed it to being a MySQL related issue since it was happening only in staging environment (MySQL) and not in the developpment one (sqlite3). Fixed it by upgrading the mysql2 from version 0.2.7 to 0.3.11.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题