NetBeans 6.9.1 + Ruby 1.9.2 + Rails 3.0.0 + MySql gem 2.8.1

This fix is for anyone that had NetBeans 6.9.1 already installed, and decided to add support for Ruby 1.9.2, Rails 3.0.0, and MySql adapter 2.8.1 on Windows XP.

That was my configuration, but it didn’t work properly. A Rails project creation always ended with an error about a non existing mysql2 gem. After some research, today I discovered that such an adapter is still to be released for Windows! So I dug into the NetBeans configs and came up with this fix that eventually allows me to cleanly create a Ruby on Rails 3.0.0 project.

  1. Install Ruby 1.9.2
  2. Install the Rails 3.0.0 gem
    • if you also had installed a Rails 3.0.0 release candidate or other versions with a 3.0.0 prefix, it’s better to remove all but the 3.0.0, because NetBeans always shows only the 3.0.0 prefix for any of them, making it impossible to select the Rails version from the NetBeans dialog box for creating a project
  3. Install the mysql 2.8.1 gem
  4. Install all the Ruby category plugins into NetBeans 6.9.1
  5. Start a fresh NetBeans and create a demo project, like this:
  6. If the demo project creation ends without any error, then you’re lucky, and there’s no reason to continue reading…
  7. Explore the folder (Ruby folder)librubygems1.9.1gemsrailties-3.0.0librailsgeneratorsrailsapptemplatesconfigdatabases
    1. Copy and paste the file mysql.yml
    2. Rename the copy as mysql2.yml
    3. Edit the file mysql.yml
      1. Replace any occurrence of mysql2 with mysql
      2. Save and close the file
  8. Explore the folder (Ruby folder)librubygems1.9.1gemsrailties-3.0.0librailsgeneratorsrailsapp
    1. Edit the file app_generator.rb
      1. Find the line
      2. Replace it with the following
      3. Save and close the file
  9. Go to 5.

That’s all. I hope it’ll work for you too 🙂

6 Replies to “NetBeans 6.9.1 + Ruby 1.9.2 + Rails 3.0.0 + MySql gem 2.8.1”

  1. Alternatively, you can just replace
    gem ‘mysql2’
    with
    gem ‘mysql’
    in your Gemfile and make sure your database.yml uses mysql adapter instead of mysql2 adapter.
    You have to do this for each new project, though.

  2. mysql2 has been released for windows…since about mid-October 2010…hopefully this makes things a little easier.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.