Custom route paths for only certain actions

activerecord, routes, ruby-on-rails, ruby-on-rails-3

Solution

What I ended up doing was simply writing a second routing rule (I was overthinking this). Since I had defined `root` in my routes, '/' was already overridden for index, new, and create.

So just by rewriting the rules for those on a separate line, it was actually quite easy.

resources :users, :path => '/users', :only => [:index, :new, :create]
resources :users, :path => '', :path_names => { :edit => 'settings' } do
    resources :photos
end

Problem

I've already got something like this: ``` resources :users, :path => '', :path_names => { :edit => 'settings' } do resources :photos end ``` Which gives me a good chunk of the routes I REALLY want. ``` /{user_id}/settings #does everything "edit" did /{user_id}/photos #lists photos for certain user ``` But my last entry on my routing wishlist is to bring back 'users' as my index path, in a resourceful and RESTful way. Because right now, the index is lost to the root URl that takes precedence. So essentially, I'd like `:path => ''` to NOT apply to the index action. I've tried adding `:except => [:index]`, but ActiveRecord still tries to match `/users/` as an id of "users". (Which are alphanumeric, so constraints don't help here.) What should I try next? Or should I buckle down and write individual "match" statements? I feel like there should be a way to build this off the resource...

Original source