quinta-feira, 6 de agosto de 2009

MySql 5.1 doesn't work with Ruby!!

I'm starting to develop applications with Ruby On Rails, my enviroment is Windows XP and Aptana Studio 1.2 or Netbeans 6.7, I'll talk about the IDE decision in other post.

Ok so I was reading my ebook, Simply Rails 2 by Patrick Lenz, I got it via email given by the editor's website, and I started to see the chapter about database interaction. When the command db:migrate was executed in the ruby console it returned the following error: "undefined method `each' for #"

First thing to do was to google the error rsrsrsrsr and after a little while in the web, something close to 30 min, I found one solution and one reason to the error.

The reason for that error to happen is that ruby 1.8 and 1.9 are still compiled to work with MySql version 5.0, they say that it might work with latter versions but that isn't my case =[.

So you have some ways to work it around:
First: Roll back your MySql version to 5.0 or earlier. Not a good one, but works.
Second: Put Instant Rails libmySQL.dll file into your ruby/bin directory. Save the old one for eventual needs. That's the one I used and works pretty well with MySql 5.1 and 6.0, at least until now.
Third: Choose another database, okay this isn't the best one but if anything else doesn't work at least there are another databases that are compatible with ruby.

If you have some work around for this problem too please feel free to comment here, or send it to my email vitor.navarro87@gmail.com and I'll make a post with your email in my blog =].

Hope this save others lives to.....

Nenhum comentário: