Posts [ 14 ]

Topic: undefined method `each' for #<Mysql:0x4841af8>

Hey everyone (sorry for posting this in the wrong forum initially),

I'm just getting setup now that I can deploy, and needed to make and preview a change on my dev system. The problem is that I had a severe data-loss, and had to reinstall everything. So my exact environment in which my Rails app got into working condition is permanently lost. And now it becomes a more serious problem.

I am working on a Mongrel/MySQL/Windows machine for development, and deploying to Dreamhost.

So how'd I get the error? I just "rake db:migrate" or "rake db:schema:load" and MySQL goes nuclear. Since there's no description of why this is happening, and this is my first Rails project, I'm really stumped at how to fix this.

This was working, and I'm sure will work on the server, but until I can regain my development environment I cannot support it.

Maybe the MySQL version is buggy? Or, Rails 2.2.2 isn't compatible with ... 2.2.1? I'll provide any info you guys need to help me out, because I really want to continue using Rails.

Re: undefined method `each' for #<Mysql:0x4841af8>

Ready to squint in wonder at the complexity? This is exactly why I can't figure it out. As I said it was working just a short while ago, but since I had to rebuild my OS and utilities from the ground up (ack) it hasn't worked right.

Re: undefined method `each' for #<Mysql:0x4841af8>

Well add me to this list - I have wasted 3 days trying to figure out why a working app on one machine would not work on another. I knew the other later setup had 5.1 & as soon as I saw this thread realized it was going to be incompatibility between MySql versions.

Re: undefined method `each' for #<Mysql:0x4841af8>

Thanks very much, Rob Anderton! This worked!! I spent a long time trying to figure out what went wrong. Also, as icing on the cake, thanks for posting a link right to the proper dll. I copied the file libmySQL.dll to my ruby\bin folder, and now everything works great!

rob-twf wrote:

You may have already seen these, but if not they suggest copying an older MySQL dll for Ruby to use as apparently the MySQL 5.1 dll doesn't play nicely with the MySQL gem...