Sunday, 9 November 2008

Learning a New Language... Ruby on Rails

I have been talking with colleagues for some time about taking up Ruby on Rails. You see, the thing with web design is that anybody can start a website these days. Expertise that was once considered a voodoo art is now readily deployed in a myriad of WordPress sites, Blogger blogs and MySpace pages. HTML, CSS and a bit of PHP here and there no longer cuts it.

A web designer that wants to put food on the table, especially in the political environment where 'change' is the word on everybody's lips, has got to stay ahead of the game. Everybody might have a blog these days, but what about when they want to take that blog a step further? What about when they want to campaign? What about when they want to raise thousands if not millions of pounds or supporters?

Join me, therefore, on a journey to learn a new language (or 'framework' as it likes to call itself) known as "Ruby on Rails" - a neat little trick that will allow me to develop application-based websites in a jiffy - from blogs to campaign sites, I will be able to do them all - or so goes the theory.

I am armed with "Ruby on Rails for Dummies" by Barry Burd and "Build Your Own Ruby on Rails Web Applications" by Patrick Lenz. Both books have been gathering dust on my shelf for some months, but I have brought them down along with a splattering of web tutorials and videos - a veritable suitcase of goodies on my trek along the Rails.

First Stop: Hosting

I need somewhere that is geared up to host "Ruby on Rails" sites. Thankfully, my existing host, MediaTemple, already offer such a service through 'Rails Containers' that will allow me to at least dip my toe in the water.

I dive into their control panel and activate my first container and application. Turns out this was a bit premature of me. It's killed my website.

You see, on the root of http://www.mikerouse.net/ I wanted to have a temporary holding page that redirected visitors to the /blog/ part of the website. Turns out all visitors get is the screenshot attached telling them that I am riding the Rails. This is going to be a long and arduous journey and I have the feeling that a lot of things are going to go wrong.

The thing is - I know nothing about Rails, well virtually anyway. I read a little about the so-called "Model-View-Controller" way of doing things and that's about it. I understand that it's quite cumbersome to get going, which is why I am grateful to MediaTemple for making the initial hurdles so easy, albeit a little dangerous for my PR management.

Next Stop: An Editing Environment

I need something that's friendly to Rails - a bit like a tribal guide who will bash down branches in my path. I turn to the "Ruby on Rails for Dummies" book and am told that "RadRails" should do nicely. Well, turns out things move faster than expected in this world of Ruby on Rails. RadRails no longer exists in the form expressed in this book. Instead, I have had to download Aptana Studio and add the RadRails plugin. That was a rather tedious affair and one I didn't fully understand if I am honest. The videos on the Aptana website were out of date also, which didn't help matters. Alas, we are now together Aptana and I - my guide to my journey - and although he's a little complicated for my liking I hope he will be effective and helpful.

Next Stop: Connecting to my Server

As I write this I have just managed to use Aptana's FTP tool to connect to the MediaTemple GridServer I am using and have opened up the database.yml file. This is the file that tells my application where my database is and what password to use. I've fed it with the necessary lingo and am about to enter Chapter 5 on the "Ruby on Rails for Dummies" book, which is going to tell me how to get a simple message to appear on my screen. Watch this space. Or rather over at http://www.mikerouse.net/ for the elusive message.

(PS: If you click mikerouse.net and get a working website then you're a bit behind on this blog post and it's either all worked out just peachy or I've had to revert to WordPress on PHP)

Why?

Good question. I've been meaning to learn Rails for ages. I want to be able to develop apps and step up my game. I'm tired of just tweaking WordPress templates and deploying basic CMS-driven sites. I want to do more. I want to offer full-featured applications for data capture, for engagement or delivery of materials/training. I want to develop Facebook apps and other cool things like that.

The problem is time.... I don't have enough of it.

I also wanted to move my blog to /blog/ and off the root so I could put a self-promotional welcome page on the root. I then got the idea to do the homepage in Rails. But, when I tried to activate this in MediaTemple's control panel it also killed the blog at /blog/. I tried switching it back off again but got 503 Gateway Error. With MediaTemple's phone lines down at the time I was up the creek. Actually, not a bad thing because now I am forced to learn Rails out of necessity - I can't put it off any more.

In addition to it being very helpful for me to document my experience, I though it nice to share it with anybody that's interested too - oh and I haven't updated this blog for ages, so it's also a good excuse to get contributing again.

0 comments: