Using ruby-1.9.2 and rails 3.2.1. The version of mysql2 is 0.2.7.
Upon running rake db:migrate I get the error: "undefined method `accept' for nil:NilClass:"
Trace includes:
gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'
Change your Gemfile
from:
gem 'activerecord-mysql2-adapter'
to:
gem 'mysql2'
Ok, I fixed on my machine. This is because of older MySQL2. Do this to resolve the problem.
bundle update mysql2
Or
bundle update
For more details visit Github
For me by removing gem 'activerecord-mysql2-adapter' from Gem File worked out
Install the lastest mysql2 ruby gem. my environtment:
Rails3.2.9 + mysql2 0.2.9, : "undefined method `accept' for nil:NilClass:"
Rails3.2.9 + mysql2 0.3.11, works fine
It can happen because of incompatibility of your mysql
and ruby
version.
To resolve this either update your mysql gem by gem install mysql
which will install latest mysql gem.
And then add this in your Gemfile
.
If still the problem exists then you should see the compatibility between your ruby and mysql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With