Routes - URLs on Rails

posted Fri, 07 Oct 2005 17:18:00 GMT by Jonas Bengtsson

As I was getting ready to get this blog out the door I wanted to change the permalinks for the entries. Normally on a Typo powered blog the entries are places under /articles/YYYY/MM/DD/name/, but I wanted to change from articles to archives. So I started updating config/routes.rb and all the places where links were created (which is quite a few). I actually got a little angry that they didn’t use custom helpers to generate all links, since it would be much easier to make the change in on place (putting them together with the routes would be even better, I thought, to honor DRY).

But somehow I realised that Rails was cleverer than that. Actually, routing works both ways – both for incoming requests and for URL generation. url_for (which is used to create URLs for links etc.) uses the routing to create the correct URLs. So to change from articles to archives all that was needed was to change config/routes.rb and everything worked. I think it’s neat with separation between URL design and controller names!

Rails’ “convention over configuration” hides some of its neatness so you’ll have to do some digging.

Comments Zero comments

Nike ID

posted Tue, 20 Sep 2005 23:41:00 GMT by Jonas Bengtsson

My Nike ID shoes

A few weeks ago I had never heard of Nike ID, but that all changed when a friend told me to check it out. Nike ID is a web shop that is way cool. You choose a product (mostly shoes, bags, and watches), and then you can customize it to your heart’s content. When you’ve placed your order they manufacture the item(s) and UPS them to you (or, as in my case, to your neighbour). I find it intriguing that they manage to manufacture customized product without charging a fortune.

I would probably not have bought anything had it not been for the price. I don’t know how the price point is in relation to stores, but when I ordered something funky was going on with some of the prices. Mistake or marketing I don’t know, but there was a 90% price cut on a number of shoes. $20 instead of $150, delivered to the door (of my neighbour) is a sweet deal in my book!

Anyhow, if you’re about to buy a Nike product, I can recommend checking Nike ID out first to see if they “stock” the product you want. It is a great feeling to have “designed” your own shoes.

ps. the “yo” is partly due to brain melt down and to the store not accepting “jonas” for some unknown reason.

Comments Zero comments