# Routes: Root as Users#Show

**URL:** <https://www.ruby-forum.com/t/routes-root-as-users-show/152477>\
**Category:** Rails\
**Created:** [November 4, 2008, 12:52pm UTC](https://www.ruby-forum.com/t/routes-root-as-users-show/152477 "2008-11-04T12:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratcheer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/aca169/32.png) [@ratcheer](https://www.ruby-forum.com/u/ratcheer)\
**Post date:** [November 4, 2008, 12:52pm UTC](https://www.ruby-forum.com/t/routes-root-as-users-show/152477/1 "2008-11-04T12:52:00Z")

</div>

Hi,  
I’d like to define the root path of my site as the Users#Show action,  
therefore whenever someone goes to [http://www.example.com](http://www.example.com) they will see  
their own profile page.  
At the moment I have done this by having the following in my routes.rb  
file:

# Home Page

map.root :controller =\> ‘users’, :action =\> ‘show’

The Users controller then looks like:  
def show  
@user = current\_user  
end

This works with respect to showing each users profile page on the route  
page. However, if tries to go to [http://www.example.com/users/anything](http://www.example.com/users/anything)  
they still see their profile page because I am setting @user to  
current\_user no matter what the request.  
I need to return 404 pages when users go to:  
[http://www.example.com/users/anything\_other\_than\_their\_id](http://www.example.com/users/anything_other_than_their_id)

What is the correct way to do this?  
Thanks

---

<div class="post-metadata">

**Author:** ![ratcheer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/aca169/32.png) [@ratcheer](https://www.ruby-forum.com/u/ratcheer)\
**Post date:** [November 4, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/routes-root-as-users-show/152477/2 "2008-11-04T21:26:44Z")

</div>

In the controller, couldn’t you look for/at params[:id] to see if the  
request was for a user other than themselves?
