I would like to hide the user_id in the URL if I can.
http://domain.com:3000/users/1
Here is the page info.
action: show
controller: users
id: ‘1’
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.
The id in the URL is required so that the controller/action knows which user it should display on the page. It shows the user with an id of 1 in this case, but in other cases, you might want to show the details of another user.
It is possible to substitute the
idin the URL with other identifying information, for exampleusername.To do this, see http://railscasts.com/episodes/63-model-name-in-url. You simply have to override the
to_parammethod in your model.