I am running Ruby on Rails 3 and I would like to set up my routes in order to rewrite URLs using namespaces, except for an action (the index action).
In the routes.rb file I have:
namespace "users", :path => "user" do
resources :accounts
end
So, for example, URLs to "show"/"create new" accounts are:
http://<site_name>/user/accounts/1
http://<site_name>/user/accounts/new
I would like to rewrite/redirect those URLs, except for the 'index' action, as/to
# For the 'index' action I would like to use plural 'users' instead of 'user'
http://<site_name>/users/accounts
# and
http://<site_name>/users
How to do that?
I tryed this
namespace "users", :path => "user", :except => :index do
resources :accounts
end
but it doesn't work.
try this
namespace "users", :path => "user" do resources :accounts, :except => :index end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With