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 my aim is to call it 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:
after that I have issue with redirecting (while its allright for me to have www.example.com/users/new for create but it is not fine when it redirects me to 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 redirection when typed 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:)