I came across this error while running my tests.
I am using Rails 3.0.3 + Ruby 1.9.2-p0 + RSpec 2.
The error ocurred when I tried to save some AR objects into my MySql database. The odd thing was that it only happened in 7 out of 10 times, or so. It was one those hard-to-trace errors.
The solution was to change my mysql adapter from mysql2 to ruby-mysql. Ruby-mysql is supposed to work better with Ruby 1.9 encodings.
So here is what I did:
1. Changed my Gemfile:
-gem 'mysql2'
+gem 'ruby-mysql'
2. Changed my config/database.yml
- adapter: mysql2
+ adapter: mysql
3. Ran "bundle install"
And that was all. After this change everything worked as expected.
Welcome!
Welcome to my blog, in here I'll try to write down experiences, reflections and technical information derived from my daily work as a software developer, analyst and researcher. Please feel free to leave your comments, thoughts or suggestions.