I’ve been quite excited by Ruby on Rails for a while now but I’ve never actually had enough time to sit down and figure things out. Well, recently I plucked up the courage and delved in.

There’s tons of tutorials out there helping you get set up and coding with Rails but I found many of the a little hard to follow and, being a designer more than a programmer, I found myself going round in circles with a lot of trial and error. I finally got myself sorted and I thought it might be useful for other people in my boat if I blogged about just what I did.

This post will tell you how I got my Windows based development environment sorted and subsequent blogs will talk you through some of the first little projects I undertook.

Installing Ruby

The first step I took was to actually get the base language (Ruby) installed–I did this using an all-in-one installer called InstantRails (http://instantrails.rubyforge.org/wiki/wiki.pl). This was a quick way to get most of the bits I needed set up but, in my trial and error I found some other cool tools. So, after unzipping InstantRails to my hard drive I fired it up and told it “not to run automatically when Windows launches”.

Setting up a database

The next step for my set up was to sort out a database server. I decided on MySQL for a couple of reasons:

  1. I was already familiar with it as I’ve been using MySQL for a few years now
  2. It’s the main database format support by my web host (Dreamhost*)

* I hope to discuss setting up Rails on Dreamhost soon, once I’ve got my own head around it!

The MySQL (http://dev.mysql.com/downloads/mysql/5.0.html) set up was quick and easy and I also installed the GUI tools (http://dev.mysql.com/downloads/gui-tools/5.0.html) as well, just in case.

Establishing a development environment

My first dabblings with Ruby on Rails made use of InstantRails and the command prompt but I soon found this confusing, especially as all I really wanted to do was get to grips with the language. It was this that led me to discover Aptana Studio (http://www.aptana.com/studio). This is a great, free development environment built on the Eclipse Java Framework. The great thing about Aptana is it has a neat Rails plugin called RadRails (http://www.aptana.com/rails/).

So, first I installed Aptana Studio and when that was complete I fired it up. Luckily the Aptana start page within the application had a handy link to install RadRails so I clicked it and let the update run.

Now, at some point either during the RadRails installation or when I created my first project I was told that I didn’t have Ruby installed and that a bundled JRuby would be used. As part of the warning I was given the chance to locate an existing Ruby installation, I did and navigated to the ruby folder as part of InstantRails. Once located, I set this to my default Ruby interpreter.

Creating your first Rails project

Once everything’s installed and you’ve re-booted your machine you can head into Aptana Studio and create your first Rails project. To do this, select File > New > Project and locate “Rails Project” in the options. When asked, provide the following details:

  • Project name — whatever you want your project to be called, “blog” for instance
  • Location — I just stuck with the default
  • Generate skeleton — you want this ticked, it’ll save a bunch of work
  • Database — set this to MySQL (if that’s the one you’re using)
  • Rails version — leave this set to “latest”
  • Server — I tend to use WEBrick rather than Mongrel and I tick to have the server start automatically

After you’ve added all that, click “finish” and your Rails application should build and start!

If you’ve been successful you should see a page similar to that above displayed within the Aptana internal browser. Congratulations, you’re rolling on Rails!