Ruby is an Object-Oriented language that was born in the mid-90's, but gained popularity in the early 2000's. As the creator of the language Matz puts it: "Ruby is about making coding natural, not simple". And once you get used to it, Ruby really begins to feel natural!

One reason for Ruby's popularity is undoubtedly Ruby on Rails aka RoR, an open source Web Development framework for Ruby. The power of RoR lies in it's simplicity and speed of development! Many popular websites like Twitter, Hulu, Scribd, and Github make use of RoR (see this).

One must note that Ruby != RoR. They're totally different!

Hopefully, this short intro has gotten you interested in Ruby and RoR. So let's see how to setup Ruby and RoR on Windows systems! Why Windows? Because the install procedure for Windows is a bit of a pain in the a** compared to the install procedure in Linux. For this article, I'll be using a system running Windows 7.

Ruby Installer is a compact package containing the entire Ruby setup and all it's dependencies. Another thing included in Ruby Installer is Ruby Gems, which is a package manager. (At it's simplest, Ruby Gems is like the Add/Remove programs feature in Windows.... except that it deals only with Ruby components/modules (which are called gems) ).

So let's get started shall we?

Double Click on the Ruby Installer executable and install Ruby into C:\Ruby

Double Click on the XAMPP executable and install XAMPP in C:\xampp

Go to My Computer-> System Properties->Advanced System Settings

Choose the Advanced tab and then click on Environment Variables

Check if C:\Ruby\bin is present in the Path row. If not present, select the Path row, click edit, and add C:\Ruby\bin; at the start.

Open a Command Prompt and do the following:C:\>ruby -vruby 1.8.

C:\>gem -v1.3.7

If you get this output (or something similar depending on the version of Ruby and RubyGem installed), you have Ruby and RubyGems installed successfully! So How about we get on the rails now, and install RoR?C:\>gem install rails --include-dependenciesINFO: `gem install -y` is now default and will be removedINFO: use --ignore-dependencies to install only the gems you listSuccessfully installed rails-3.0.01 gem installedInstalling ri documentation for rails-3.0.0...

Yeah! So we're all set with RoR! Now let's get XAMPP configured shall we? Go to C:\xampp\htdocs and create a new folder where your RoR project will reside. Let's name this folder Ruby.

Now go to C:\xampp\apache\conf and open the file named httpd.conf with a text editor (I use Notepad++) and add the following right at the end of the file:Listen 3000LoadModule rewrite_module modules/mod_rewrite.so################################## RUBY SETUP#################################<virtualHost *:3000>ServerName railsDocumentRoot "c:/xampp/htdocs/ruby/public"<Directory "c:/xampp/htdocs/ruby/public/"

If you now go to C:\xampp\htdocs\ruby, you should see something like this:

These are all the files created automagically by RoR! Nice, ain't it?

Start XAMPP and start the MySQL and Apache services:

Open a browser (Read: Firefox! :) ) and type in http://localhost:3000 ... and you should see this page:

That's it... you're now officially on the Rails! So now it's time to start developing you web apps with RoR!

Notes:

Gems are, in my opinion, the most powerful feature of Ruby. Gems are like modules that can easily be used in any project. I'd urge you to head over to this site, which holds over 16500 Ruby gems. Installing any gem is the same procedure as Step 7. Just type in gem install [gemname] to download and install the gem. You will probably need gems like mysql (gem install mysql), sinatra (gem install sinatra) etc. for web app development.

Yes, I know this is NOT the only way to install RoR. But I use XAMPP for almost everything so have included it here as well! This procedure should ideally work with WampServer as well, as long as the paths are corrected.

By default, RoR assumes that your MySQL root password is absent. However if you have assigned a root password, you must change the database.yml file present in C:\xampp\htdocs\Ruby\config.yml . Also, RoR recommends the creation of 3 databases: One each for testing, development and production. By convention they are named as [projectname]_test,[projectname]_production and [projectname]_production. You will have to create these databases externally through MySQL or using rake db:migrate. If you prefer to use alternative names, simply modify the config.yml file with names of your choice!

RoR on Windows really is a bit of a pain, and may not even work the first time! Honestly, I believe any serious developer must be comfortable working in Linux, which is more suited to the need! RoR on Linux is a breeze and works great (if not better)!

So far, I'm having an awesome time on Rails and am looking forward to working more in RoR! Hope you too enjoy the trip on rails! :)

In college, we're just beginning with RoR , and I wanted people to be comfortable with the XAMPP/WAMP setup that we've been using so far! This post was actually written specifically for my college mates! :)

Infact one of the reasons I chose to have this post specific to a Windows system was because most of my collegemates use Windows! :)

The Apache configuration (point 10 of your description)is not proper working. Take the following two parts and don't forget to change pathes of the document root.Just add a Listen 3000 down the line where Liste 80 is located. Then place the two following two hosts at the end of the config.http.

Awesome post! Thank you! This was really helpful. I'm also having the same issue as the last person that commented the Rails logo is not showing. I already tried changing the path from assets/rails.png to background-image: url("../assets/images/rails.png"); but nothing seem to work. :-(