If I had a user resource, I might have a page like /users/1. What I want is to be able to make it so that if someone types in /users/admin (an alias) it will just go to /users/1.
In the routes.rb file I can do this:
match '/users/admin' => redirect('/users/1')
But then the URL in the web browser still just shows /users/1. Plus, I don’t get any routes for this, like admin_path, which would be nice and helpful, though that’s just a bonus.
My goal in this is similar to what Facebook does when you choose a “nickname” and if you go to facebook.com/whatever it takes you to a profile, but the URL is still just /whatever, and doesn’t change to something like /profile?id=1234
Anyone know how to do this?
Thanks.
1 Answer