Rails in a Windows World

My day job consists of writing both Windows applications or web applications that run on Windows web servers.   Most of my code is C# and using SQL Server 2005 to store the data, it pays the bills.

I have been working with Ruby on Rails for the past year to year an a half.  I really like Rails as it is very well thought out and implements some very nice standard patterns of application architecture, namely MVC (model view controller).

I have tried many ways to run Rails but keep trying to come back to what I know, Windows.    My journey consisted of :

  • Linux (virtualized) – I used a Virtual PC at first and install Fedora Core, Debian, Suse and Ubuntu, installed Ruby, gems and Rails, no problem.
  • Linux (native) – I setup both Fedora and Ubuntu, installed Ruby, gems and Rails, no problem.

All the Linux distributions, either native or virtual worked well for the install but I got into trouble was attempting to setup Apache and MySQL.   My ignorance of  Linux was my downfall, Linux is great and I will probably end up deploying on Linux the learning curve too much.  There are so many ways to configure Apache and MySql posted on the web to make my head spin.

I have noticed some companies are creating “Rails Stacks” for Linux that are standard installs of Linux, Ruby, Rails, web server (Apache and/or Mongrel) and a database.   Railsmachine announced just such a stack, as did Thoughtworks.

I also decided to go the route of what all the other “pure” Rails developers do and use a Mac.  Yes, I said it, I bought a nice new Apple MacBook Pro and installed TextMate along with Rails on it.  I found out rather quickly that OSX is nothing more than Linux with a shiny cover.  I used the MacBook for a few weeks but found the UI irritating and lacking in usability.  Sure, it could have just been my many years of Windows hurting my Mac productivity, but it felt more like I was trying to be productive in a cartoon.

I did enjoy TextMate, it was a very good text editor in an otherwise poor development environment.

With all of the beating Microsoft gets for it practices and it’s products, I admit they do a very good job giving developers great tools.  I have become accustomed to Visual Studio and Intellisense.  Try finding any resemblance of Intellisense on your Mac environment, good luck, it’s not there.    Intellisense makes my productivity go way up.

Rails on Windows

I decided instead of forcing myself into Linux or some cousin thereof, I would stick with Windows and figure out the best way for me to do Rails development.

There are a couple different ways to get Ruby and Rails running on Windows.  You can either install each individual component (Ruby, Ruby Gems, Rails) or install as a package or stack.  The easiest way to get up-and-running fast is to download and install Instant Rails.  I have to give these guys credit, they take all of the work out of getting a full Rails implementation running on Windows.  InstantRails includes everything you need; Ruby, Ruby Gems, Rails, Mongrel (web server), MySQL, phpMyAdmin and some sample applications.  You have the full environment so you can install whatever gems you may need.

I decided to use Instant Rails in conjunction with setting up and running Rails separate, primarily for the experience and to have the most flexibility on my system.

I started with installing Ruby (One-Click installer) and Ruby Gems and then installing Rails from the command line, like this:

gem install rails --include-dependencies

and that was it.   In both Instant Rails and the native install I also install Rake and Capistrano.  Rake is a nice build utility that allows you to write your scripts in Ruby and Capistrano will help deploy your applications.  These are also installed using gem install.

Replacing TextMate was  a lot easier than I thought it would be.  I found E-Text Editor.  It is in beta as I write this but is truly useful as-is.  You can see how much it looks like TextMate, including a ton of bundles.


All of this so far has been a great way to do Rails development on Windows, but wait it even gets better.  As I said already, I use Visual Studio 2005 all day.  I found a great VS.NET add-in called Ruby in Steel.  I have blogged about it before and have used it for a while and am spoiled by it.

You can see the same Rails project loaded in Ruby in Steel.  Does it look like the familiar VS interface?  I hope so.


The best part of using Ruby in Steel is…Intellisense.  Can you tell I like Intellisense?  You can do debugging like you can in other VS languages as well.  These guys are doing a great job with bringing all the Rails goodness to Windows and Visual Studio in particular, they don’t get enough credit for their efforts.  Support is top-notch as well.

The last piece I really needed to decide on was the database and it is a toss up between MySQL, PostgreSQL or SQLite.  It seems Rails has great support for all of the choices but MySQL has been supported the longest.  They all run on Windows so I don’t know if it matters that much, I chose MySQL.

In case you want all the goodness of MVC but don’t want to write Ruby code then maybe checking out the CastleProject and MonoRail.  This is a full-blown MVC on Windows without using ASP.NET WebForms, which they incidentally have multiple ways to solve the same problem.  I for one, am checking them out now and writing some sample applications, they feel a lot like Rails.  I would take a look at one of their nightly builds which contain the latest and greatest.  The Windows install is a bit old at this point.

Finally, I think today is a great time to start developing Rails application under Windows where you might be the most comfortable.  Please email me with other tips and suggestions. 

Technorati Tags: , , , , , , ,


2 responses to “Rails in a Windows World

  1. Great posting! I’ve been interested in getting started with Ruby one of these days as well – thanks for the tips on getting started.

    Have you heard/peeped of the IronRuby project John Lam is working on? He’s released a preview of it on his blog…

  2. Thank you. It is getting easier and easier to get started with Ruby and Ruby on Rails using Windows.

    I didn’t mention IronRuby in this post as I had mentioned it in a previous post. I just started using IronRuby and it is in very early stages but looks promising. I plan to port Rails over to it once IronRuby is a better state. I think Microsoft is doing a good thing bringing Ruby on the CLR.

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s