customize resource routes

Hi all,

I have this application that lists videogames, which i am rewriting to
follow REST.

I need to have this url :
/games/xbox360/halo-3 ( map.connect "/
games/:platform_id/:permalink",:controller => "games",:action =>
"show" )

This is no problem with map.connect, but with map.resources i can not
make this.

map.resources :games do |game|
    game.resources :supply_used

The command makes the following url :

How can i still use map.resources and have :platform_id in my url? Or
do i need to make custom map.connects for each url?


if you really up to rest, you should be ok with urls like this
or, more practical
where 10, 2 - record id's

you'll need to have
map.resources :platforms { |platform| platform.resources :games }
among your routes and tweak your Platform and Game to_param method to
return platform and game title instead of id (you will have to keep
titles unique, tho) or id, followed by title, which is preferred

Thanks for the answer.

if you really up to rest, you should be ok with urls like this

But admit it : /games/xbox360/halo-3 looks better than /platforms/
xbox360/games/halo-3 :slight_smile:

Also, I would like to keep this url because it existed in the old
website like that.

Legacy, I understand :slight_smile:
In my opinion, it looks shorter, but not more readable.
However, it's only up to how to lay out your uris, rest is not panacea
and all map.resources is in fact doing is creating a set of named
routes automatically for you.