This project is archived and is in readonly mode.
shallow nesting of resource routes does not respect namespace
-
ckozus
Is this a bug or a feature?
-
Jason M Jones
To me it seems like a bug. Some things still stay under the namespace, others do not. It seems like an unintended consequence of the new feature. For instance, lets say I have two resource controllers
- TestsController
- Admin::TestsController
I could then have routes
map.namespace :admin do |admin| admin.resources :tests, :shallow => true do |parent|
parent.resources :commentsend end
map.resources :tests
I would have conflicts in my routes between Admin::TestsController and TestsController, where with namespaces, I should be able to address each seperately.
-
Ben Lambert
This has been driving me nuts, definitely a bug. I'm going to have to un-dry my routes.rb to work around this.
map.namespace :admin, :shallow => true do |admin|
admin.resources :restaurants, do |restaurant| restaurant.resources :campaigns restaurant.resources :locations endend
I should be able to view a campaign via admin/restaurants/1/campaigns/1 or admin/campaigns/1
However as it stands now, I can view a restaurant via admin/restaurants/1
But the campaigns are completely removed from the namespace, and can be accessed only via: /restaurants/1/campaigns/1 or /campaigns/1
It really defeats the purpose of having a namespace in the first place.
-
Ben Lambert
I wish Lighthouse came with a preview or edit button. Let me try that again.
This has been driving me nuts, definitely a bug. I'm going to have > to un-dry my routes.rb to work around this.
@@@ map.namespace :admin, :shallow => true do |admin| admin.resources :restaurants, do |restaurant|
restaurant.resources :campaigns restaurant.resources :locationsend end @@@
I should be able to view a campaign via @@@admin/restaurants/1/campaigns/1@@@ or @@@admin/campaigns/1@@@
However as it stands now, I can view a restaurant via @@@admin/restaurants/1@@@
The campaigns are completely removed from the namespace, and can be accessed only via @@@/restaurants/1/campaigns/1@@@ or @@@/campaigns/1@@@
It really defeats the purpose of having a namespace in the first place.
-
Ben Lambert
Third time lucky:
This has been driving me nuts, definitely a bug. I'm going to have to un-dry my routes.rb to work around this.
map.namespace :admin, :shallow => true do |admin| admin.resources :restaurants, do |restaurant| restaurant.resources :campaigns restaurant.resources :locations end endI should be able to view a campaign via
admin/restaurants/1/campaigns/1 @@@ oradmin/campaigns/1
However as it stands now, I can view a restaurant viaadmin/restaurants/1
but the campaigns are completely removed from the namespace, and can be accessed only via/restaurants/1/campaigns/1
or/campaigns/1
It really defeats the purpose of having a namespace in the first place. -
David Reese
+1, fwiw -- my routes are a mess because of this.
i'd look at it myself but the routing code makes my head hurt.
-
Tom Stuart
This does the trick, innit.
-
Tom Stuart
lifo, can we get this patch in before 2.3 final?
-
Tom Stuart
- Assigned user changed from Pratik to Michael Koziarski
-
Repository
- State changed from new to resolved
(from [5c87e9adddc22703a3dbbb785e32fafe0e91ce78]) Ensure shallow routes respects namespace [#1356 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
