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:
- Downloaded and installed the Ruby Installer for Windows – I used rubyinstaller-1.8.6-p383-rc1.exe.
- 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.
- Next, I installed the MySQL gem:
gem install mysql --source http://gems.rubyinstaller.org
- I chose to install the same version of Rails that I had been working with previously:
gem install -v=2.3.4 rails
- I was then able to re-create my database, load the schema, and see all of my views!
- 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
- 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.
Filed under: Ruby on Rails | 3 Comments
Tags: gem, install, polymorphic associations, rails, setup, shoulda, troubleshotting, windows, windows7, xampp