# Rails 2.1 REST and custom routing - newbie question

**URL:** <https://www.ruby-forum.com/t/rails-2-1-rest-and-custom-routing-newbie-question/144408>\
**Category:** Rails\
**Created:** [July 29, 2008, 12:39pm UTC](https://www.ruby-forum.com/t/rails-2-1-rest-and-custom-routing-newbie-question/144408 "2008-07-29T12:39:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bartosz\_Wais](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ed8c4c/32.png) [@Bartosz\_Wais](https://www.ruby-forum.com/u/Bartosz_Wais)\
**Post date:** [July 29, 2008, 12:39pm UTC](https://www.ruby-forum.com/t/rails-2-1-rest-and-custom-routing-newbie-question/144408/1 "2008-07-29T12:39:55Z")

</div>

Hi everybody, I am working on my first rest RoR app, and in short:  
i have resource e.g (users)  
instead of calling it using _[www.example.com/users/id](http://www.example.com/users/id)_ my aim is to call  
it  
\*[www.example.com/id](http://www.example.com/id)  
\*  
_id_ is pointing in my case to users.name field in database.

My question is what is the Rails Way of doing it? I tried on few  
different  
ways but as it is more “do to learn” project I wish to do it right.

My guess is to do in routing file:  
map.resource :users  
map.root :users

after that I have issue with redirecting (while its allright for me to  
have  
\*[www.example.com/users/new](http://www.example.com/users/new) \*for create but it is not fine when it  
redirects  
me to \*[www.example.com/users](http://www.example.com/users) \*after that.

Should I “hack” it using map.connect? or maybe from inside resource  
controller?  
Should I gave up with :resource shortcut and do it manually using named  
routes?

The 2nd part of my question is (just to make it harder a bit) i wish to  
have  
something like _[www.example.com/welcome](http://www.example.com/welcome) redirection when typed \*  
 [www.example.com](http://www.example.com) (welcome as a action of users)_. \*I know to use  
:collection  
for :users resources… but how to make it work with map.root :users ?

I am quite sure that how to of similar thing is somewhere to be found  
on-line, but I didn’t find it… hope to get at least tip:)

thanks
