I am sure there is a simple solution to this but I can’t seem to find it.
I want to match the following dynamic username:
/users/dymanicUsername
How would this look in routes.rb
Thanks for any help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
allister,
To do that, just override to_param in your model. For instance :
You will soon bump into some problems :
username_urlized, that of course should be unique and not conflicting with other routesAnd maybe more problems 🙂
Also, if you want something like twitter (yoursite.com/dynamicUserName), do the following in routes.rb :