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 W. 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
2009/7/7, Rails L. [email protected]:
–
Von meinen Mobilgerät aus gesendet
You can overwrite to_param to return the random thing and use
find_by_random_thing params[:id] in your controller actions
2009/7/8, mike [email protected]:
value of that object?
–
Von meinen Mobilgerät aus gesendet
–
Von meinen Mobilgerät aus gesendet
On Jul 7, 1:32 am, Rails L. [email protected]
wrote:
Did you try this in routes -
map.connect ‘societies/:something/edit’, :action=>‘aaa’,
:controller=>‘ccc’
- example. societies/:rkey/edit
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.