Oct 21 2007

Okay, Rails, That Was Cool: Routes

So, I’m building this website, and there’s a reference section for different kinds of stones. These are being represented by passing a “stone” parameter into a controller, which renders lots of search-engine-unfriendly URLs like “http://blah.com/stone_meanings?stone=Agate”.

I wanted to set up a route so that I could turn that into a more SEO-friendly URL. So I jump into routes, and add a quickie little line, which I pretty much stole directly from The Friendly Manual. I tested out my new URL format, and that worked out slick.

So, now it was off to change all the references, and get them to use the niftier URL. An hour of work or so, I figured, as I was going to have to 1) figure out the flag to flip, and 2) find all the places the controller was referenced through text searches. So I fired up the website and took a look.

And I saw I didn’t have to do anything. Rails automatically updated all of the places I was going to the controller with the new URL. So, with that one line of code, my entire website was just updated to Do the Right Thing.

I thought I was going to have to go text-searching to refactor the site, and things just magically worked for the better. That saved me a budgeted hour, and I’m impressed.

The whole conventional web site development process is really impressing me. I’m able to get a LOT done very quickly, and (even more) I can leverage that pattern so that quasi-technical business people (in this case, my designer and wife) can build the website behind me. I’m a big fan of pawning the design and day-to-day maintenance off on other people.

Popularity: 4% [?]

3 Responses to “Okay, Rails, That Was Cool: Routes”

  1. Joeon 22 Oct 2007 at 8:58 am

    Out of curiosity, why did you pick rails over say, django (or nitro if you like ruby)? I haven’t tried nitro since I don’t really like ruby, but “real” ruby fans seem to think its not an embarrassment to the language the way rails is.

  2. Robert Fischeron 22 Oct 2007 at 11:00 am

    I picked Rails because:

    1) I want Rails on my resume
    2) I already had some rails experience but wanted more so I could speak more intelligently at RUM
    3) I knew it had a big enough community (blogs, manuals, books, IRC) to go for support when things got rough
    4) I knew it worked pretty well (I didn’t realize quite how well it worked)

  3. [...] a while back I was impressed by Rails routing. It was a nice little surprise which came out of left field to [...]

Trackback URI | Comments RSS

Leave a Reply

Green Web Hosting! This site hosted by DreamHost.