Rails Overview: Intro and Getting Started

So, here goes… there’s plenty to say so my overview of Ruby on Rails is going to be a multi-parter. Note, this isn’t going to be a tutorial – there are plenty of those about. This is my view on what makes Rails hot and where it’s not based on my experiences as a Rails newbie. My background, for reference, is with J2EE professionally, and PHP on the side.

Firstly, a very brief introduction for those who haven’t a clue what I’m talking about. Ruby is an interpreted object-oriented programming language which, whilst nice enough, is in itself nothing special. Rails, is an open source web application framework that prides itself on productivity without sacrificing maintainability. Its sweet spot is with database driven applications which is where I came in…

I have an online entries system for orienteering events written in PHP with MySQL at the backend. Over the years it has been used for various different types of event and has been extended in every which way until the code base had become a mess calling for either a major refactor or a rewrite. So, what better excuse to give Rails a whirl? Conveniently, this coincided with a busy time at work and lots of travelling which meant I actually read Agile Web Development with Rails cover to cover before writing a line of code. This has to be definitive guide to the subject and is a good mixture of introductory and reference material.

Next step was to set up my development environment. I’m currently using Ubuntu Edge (in a VMWare image so I can take it with me when I’m on the road) so I could use apt-get to pull down Ruby and the Ruby package management system RubyGems. I then used gems to install Rails and its dependencies. And that’s it – along with your favourite editor, everything you need to get started developing with Rails downloaded an installed in ten minutes.

Starting on your first application is then trivial. The simple command rails myapp creates a directory myapp and all of the necessary subdirectories and files required for a working Rails application. One of those files is a script which can be used to run the application on Ruby’s built in web server WEBrick. And there you are, done, your first Ruby application. OK, it doesn’t actually do anything other than display the standard generated index page but three hours later I’d still be downloading Rational Application Developer!

2 Responses to “Rails Overview: Intro and Getting Started”

  1. Neil says:

    Dave,
    a minor question, why Ubuntu? I have tried Ununtu and find that compared to pure unadulaterated debian it is second best by quite a long way. It is fine if you want to play DVDs etc but otherwise pure debian is much nicer.

    cheers,
    Neil

  2. Dave says:

    Neil – No particular reason. I used to have Debian installed on my desktop machine at work but when IBM took up the Linux banner it wasn’t one of the blessed distros so I now have RHEL. I just happened to stumble across an Ubuntu VMWare image and thought I’d see what all of the fuss was about and haven’t stopped using yet.