Rails routes creating additional info in URL
Posted
by Danny McClelland
on Stack Overflow
See other posts from Stack Overflow
or by Danny McClelland
Published on 2010-05-13T14:25:24Z
Indexed on
2010/05/13
15:54 UTC
Read the original article
Hit count: 540
Hi Everyone,
Say if I have a model called 'deliver' and I am using the default URL route of:
# Install the default routes as the lowest priority.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
So the deliver URL would be:
http://localhost:3000/deliver/123
What I am trying to work out, is how to use another field from the database alongside or instead of the ID.
For example. If I have a field in the create view called 'deliveraddress', how do I put that into the routes?
So I can have something link this:
http://localhost:3000/deliver/deliveraddress
Thanks,
Danny
© Stack Overflow or respective owner