RoR and SQL issu

I've set up on Windows 7 Eclipse with ruby and radrails and want to use MySQL as a database. I've executed: gem install mysql2 And changed the database.yml

I have tried to use MySQL 5.5 and 5.1 and the error still exists.

rake aborted! Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.)

I've also copia a libmysql dll into de ruby .bin folder.

Any help? I have searched everywhere and cant get it fix. How and where in the gem file do I add what?

On another note, if I have 2 tables, one with its primary key being a foreign key, does RoR automatically create a <columname_to> on that table?

Thanks in advance, im stuck :confused:

Attachments: http://www.ruby-forum.com/attachment/7225/rake.jpg

I've set up on Windows 7 Eclipse with ruby and radrails and want to use MySQL as a database. I've executed: gem install mysql2 And changed the database.yml

what did you change it to? I'd wager you've got adapter: mysql, whereas it should be adapter mysql2

Any help? I have searched everywhere and cant get it fix. How and where in the gem file do I add what?

Your Gemfile lists all the gems your app uses, if you're using the mysql2 gem you'd need

gem 'mysql2'

(If you're using an older rails version you may need to specify a version of mysql2 that is compatible with your rails version.

On another note, if I have 2 tables, one with its primary key being a foreign key, does RoR automatically create a <columname_to> on that table?

Not sure I quite get the question, but rails doesn't create any columns automatically. Use a migration to add tables or change existing tables. There are a few shortcuts you can use in the migration / generators (e.g. rails g model1 model2:belongs_to will add a column called model2_id as well as an index)

Fred

Your Gemfile lists all the gems your app uses, if you're using the mysql2 gem you'd need

gem 'mysql2'

(If you're using an older rails version you may need to specify a version of mysql2 that is compatible with your rails version.

Im using rails 3.2.2 na in my: C:\Ruby187\lib\ruby\gems\1.8\gems

folder I can see the: mysql-2.8.1-x86-mingw32, mysql2-0.3.11-x86-mingw32 and mysql2-0.3.11-x86-mswin32-60

folders.

Doesn't this mean its installed already? :confused:

Your rails app will only use the gems specified in your Gemfile (and their dependencies). If it's not in your Gemfile, it's not loaded, even if it is already installed

Fred

Your rails app will only use the gems specified in your Gemfile (and their dependencies). If it's not in your Gemfile, it's not loaded, even if it is already installed

Fred

Thank you for the explanation and time dedicated Fred

Best regards