Hello!
Recently I’ve faced with a problem during programming on Ruby on Rails platform.
I’m a newbie and just tried to follow the lessons described in my book. I had to make database migration using
rake db:migrate command. I’ve written a migration class before the action according to the book example:

class CreatePhotos < ActiveRecord::Migration
    def self.up
        create_table :cars do |photo|
            photo.column "model", :string
        end
    end

    def self.down
        drop_table :cars
    end
end


But unfortunately “undefined method `each' for #<Mysql:0x3874b20>” message has appeared after the command execution. Also ruby had crashed occasionally.
After little exploration I’ve got the reason of the problem. Ruby MySQL driver which I’ve installed using gem install mysql command didn’t correspond to my MySQL server version. Actually I’ve installed MySQL v5.1.31 and mysql gem v2.7.3. After server version downgrading down to 5.0 I’ve got it working!

0 comments: