Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

routing: namespace ignored inside resources

#3996

Using Rails 2.3.5, the following route definition:

map.resources :users do |users|

users.namespace :admin do |admin|
  admin.resources :products
end

end

should produce a route:

user_admin_product GET /x/users/:user_id/admin/products/:id

but it actually produces:

    user_product GET    /users/:user_id/products/:id

i.e. the 'admin' namespace gets lost.

Note however if I nest this all inside a top level namespace, the inner 'admin' namespace reappears:

map.namespace :x do |x|
map.resources :users do |users|

users.namespace :admin do |admin|
  admin.resources :products
end

end

x_user_admin_product GET /x/users/:user_id/admin/products/:id

Reported by Sam Pierson · February 18th, 2010 @ 11:57 PM

State: resolved
Milestone: none
Assigned to: Ryan Bigg Ryan Bigg
Importance: Low

Activity

  1. David Trasbo
    David Trasbo
    • Assigned user set to Ryan Bigg

    That's the desired behavior. Namespaces are only ment to work in the outer most level, and I think that's the case for both master 2-3-stable.

    "Fixing" this would almost certainly require a major refactoring. Patches are welcome! For now, this can be closed.

    June 30th, 2010 @ 12:42 PM

  2. Mike Riley
    Mike Riley
    • State changed from new to resolved
    • Importance changed from to Low

    Hello,

    Closing this out based on David's reply.

    Mike Riley

    July 29th, 2010 @ 08:15 PM