Trying out Ruby on Rails

I made it one of my resolutions to learn Ruby this year, so I took a bit of time yesterday and today to try and get something working on my work laptop running Windows XP. I’d used the one-click Windows installer for Ruby a week before, so I was able to use RubyGems to install Rails. I put the latest version of MySQL on the laptop as well, since the tutorial I’m following uses it.

Instead of building the cookbook application the tutorial describes, I’m trying to build an app that serves a database-driven RSS feed. My reason is that we’ve done this for a client project with some old ASP code and I wanted to compare architectures and level of effort. So far, I like the way Ruby on Rails works. You can create an empty web app just by typing ‘rails ‘ at a Windows prompt. The application directory structure follows the model-view-controller design pattern, so there’s no wondering about where to put certain types of code if you’re familiar with the concept. Generating stubs for controllers and models is also simple (“ruby scriptgenerate controller ” and “ruby scriptgenerate model ” in the web application folder respectively).

Development Ruby on Rails seems to go fastest if you follow their naming conventions for code, and the table names in MySQL. When the model name is singular form of the database table name in plural form (recipe–>recipes or podcast–>podcasts), using “scaffold :” in your controller definition autogenerates the CRUD operations against that table in the database. Making changes then becomes a simple database change exercise. Once a column is added, moved, or removed from a table, just refreshing the browser shows the changes.

I’ll probably go back through the cookbook example and follow it step-for-step before going back to the podcast example, just so I have something stock that’s working. The other thing I plan to do is to replicate my work on the Mac mini I have at home.

Comments

  1. Dave says:

    I too am going to rededicate learning Rails – just so I can say I did it. I have more than a couple projects that I want to complete and if I can get one of them sketched out successfully, I might just finish it up in rails.

    I’ll be talking about it more on my site, but I just got my laptop set back up with Linux again (Mandriva 2006) and will be developing there. My last attempts with Ruby on Windows weren’t very successful (see my blog) and I figure I’d give it a shot in a more “native” environment.

    I don’t believe the hype, but we’ll see. Its going to have to be so exceptionally good for it to beat out my current rapid development love: Gentle.Net and MyGeneration.

Leave a Reply to Dave Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.