I have a users controller.
For a specific user I want to have something like this
example.com/a_constant_string ==> example.com/users/2
I just need for a specific user, not for all users. You can say
link_to 'Go to a specific user', @user
link_to 'Go to a specific user', user_path(@user)
link_to 'Go to a specific user', a_constant_string_path
Should be same.
You could create a redirect route in config/routes.rb:
match '/a_constant_string', :to => redirect("/users/2")
Which would redirect to the correct path, and gives you the URL and PATH helpers: a_constant_string_path
and a_constant_string_url
.