Reputation: 15259
I am running Ruby on Rails 3 and I would like to set up my routes in order to rewrite URLs using namespaces.
In the routes.rb file I have:
namespace "users" do
resources :account_auth
end
So, URLs to "show an"/"create a new" account_auth page are:
http://<site_name>/users/account_auths/1
http://<site_name>/users/account_auths/new
I would like to rewrite/redirect those URLs as/to
# from 'account_auth' to 'auth'
http://<site_name>/users/auth/1
http://<site_name>/users/auth/new
How to do that? If it can be, what kinds of problems could I have?
Upvotes: 2
Views: 769
Reputation: 10874
Use the :path option:
namespace :users do resources :account_auth, :path => "auth" end
Upvotes: 2