How to use different key than :id in route?

Okay, so I'm trying to have a URL like the following (which uses a key generated at random):

societies/6b241c631c6beaa89c889b9fb388caef9f617900ca1eff societies/6b241c631c6beaa89c889b9fb388caef9f617900ca1eff/edit

Where do I change the default behavior from using the ID, to another value of that object?

Ben Wilson wrote:

Okay, so I'm trying to have a URL like the following (which uses a key generated at random):

societies/6b241c631c6beaa89c889b9fb388caef9f617900ca1eff societies/6b241c631c6beaa89c889b9fb388caef9f617900ca1eff/edit

Where do I change the default behavior from using the ID, to another value of that object?

Did you try this in routes -

map.connect 'societies/:something/edit', :action=>'aaa', :controller=>'ccc'

- example. societies/:rkey/edit -- Posted via http://www.ruby-forum.com/.

>

You can overwrite to_param to return the random thing and use find_by_random_thing params[:id] in your controller actions

I'd like to avoid rewriting routes (I mean, I can do map.resources :societies)

I'll try the to_params, that one slipped my mind.