I am running Ruby on Rails 3, and I would like to configure my routes to rewrite URLs using namespaces except for the action (index action).
In the routes.rb file, I have:
namespace "users", :path => "user" do
resources :accounts
end
So, for example, the URLs for "show" / "create new" accounts are:
http://<site_name>/user/accounts/1
http://<site_name>/user/accounts/new
I would like to rewrite / redirect these urls except for the "index" action like / to
http://<site_name>/users/accounts
http://<site_name>/users
How to do it?
I tried this one
namespace "users", :path => "user", :except => :index do
resources :accounts
end
but that will not work.
source
share