Today in the saga of Installing Ruby on Rails on Windows 7


After countless problems today, I ended up rolling Rails back to version 2.3.4 and Ruby to version 1.8.6.

Note: it may say to Ctrl-C to shutdown the server, but you actually have to do Ctrl+Break.

And note to self: Some of my tests use the “should_ensure_length_at_most” macro in shoulda, which for some reason isn’t in the version that “gem install shoulda” grabs. It is in the source file active_record/macros.rb.

Let’s take a step back now and look at what I did to get Ruby on Rails working on Windows 7.

I had already installed XAMPP, which contains a MySQL server. For the most part, I followed Luis Lavena’s tutorial RubyInstaller: Getting Started with Rails and MySQL:

  1. Downloaded and installed the Ruby Installer for Windows – I used rubyinstaller-1.8.6-p383-rc1.exe.
  2. Since I already had an installation of MySQL from XAMPP, I just needed to copy the libmySQL.dll file from that installation into C:\Ruby\bin. This worked fine for creating the database, but I ran into errors when I tried to load the schema – MySQL Server 5.1 does not play nicely with my version of Rails. The older version of libmySQL.dll linked in the top rated answer solved my problem.
  3. Next, I installed the MySQL gem:
    gem install mysql --source
  4. I chose to install the same version of Rails that I had been working with previously:
    gem install -v=2.3.4 rails
  5. I was then able to re-create my database, load the schema, and see all of my views!
  6. After some playing around, I noticed that the pages were loading much slower than they had on my previous setup, so I decided to install the server I had been using before, mongrel:
    gem install mongrel
  7. Lastly, I wanted to run my tests, so I needed to re-install my test framework:
    gem install shoulda

After I installed shoulda, all of my tests passed, except for one. I am getting the following error:

NoMethodError: undefined method `quoted_table_name' for Object:Class

which is coming from line 323 in C:\Ruby19\lib\ruby\gems\1.9.1\gems\activerecord-2.3.4\lib\active_record\association_preload.rb:

table_name = klass.quoted_table_name

This particular controller corresponds to a model using polymorphic associations:

belongs_to :budgetable, :polymorphic => true

That’s my only clue so far, as the test is erroring when trying to retrieve all BudgetMonths and pre-load the budgetable association. If I don’t pre-load that association, then the test *will* pass, but I’d still like to know what I can do to be able to pre-load polymorphic associations.


3 Responses to “Today in the saga of Installing Ruby on Rails on Windows 7”

  1. Hello Tara:

    You say that you installed Ruby 1.8.6, but from the path you displayed in the error of “quoted_table_name”, seems you used Ruby 1.9 instead.

    Also, for what is worth, using script/server will not work with Ctrl-C, seems that the script forgets to trap the INT signal and shutdown the server, which is supposed to happen.

    On the same 1.9 topic, mongrel has not been made 1.9 compatible yet. You can use Thin instead (gem install thin).


    • Thanks for the response! I did install Ruby 1.8.6. I quoted the path for Ruby 1.9 because when I did the uninstall, I’d left that file open and the error message for Ruby 1.8.6 makes it look like the problem stems from my line of code and doesn’t give any trace back to the Ruby code at all.

  2. You’ve probably moved on by now, but for anyone else who finds this via google, you probably have a blank (either nil, or empty string) xxx_type in your polymorphic relationship.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: