This project is archived and is in readonly mode.
Namespaced routes not working on Rails 3
Reported by Joao Carlos | January 9th, 2010 @ 02:27 AM | in 3.0.2
If my routes.rb contains:
namespace :admin do
resources :pages
end
Then my routes will have the wrong controller ('pages' instead
of 'admin/pages').
Output of 'rake routes':
admin_pages GET /admin/pages(.:format) {:controller=>"pages", :action=>"index"}
POST /admin/pages(.:format) {:controller=>"pages", :action=>"create"}
new_admin_page GET /admin/pages/new(.:format) {:controller=>"pages", :action=>"new"}
admin_page GET /admin/pages/:id(.:format) {:controller=>"pages", :action=>"show"}
PUT /admin/pages/:id(.:format) {:controller=>"pages", :action=>"update"}
DELETE /admin/pages/:id(.:format) {:controller=>"pages", :action=>"destroy"}
edit_admin_page GET /admin/pages/:id/edit(.:format) {:controller=>"pages", :action=>"edit"}
My patch seems to fix the issue. As far as I can tell it doesn't break anything.
Comments and changes to this ticket
-
Joao Carlos January 9th, 2010 @ 02:32 AM
- Tag changed from patch routes namespace to namespace, patch, routes
-
José Valim January 9th, 2010 @ 05:59 PM
- Assigned user set to José Valim
-
Repository January 10th, 2010 @ 07:21 PM
(from [36969c6ecd69fc285bf0267805152319a4b71ceb]) Fixes namespaced routes [#3673 status:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/36969c6ecd69fc285bf02678051523... -
José Valim January 10th, 2010 @ 07:22 PM
- State changed from new to committed
Thanks for the patch!
-
Daniele Orlandi April 23rd, 2010 @ 10:50 AM
I think the patch should consider the case when we want to explicitly indicate a controller outside the namespace, for example:
namespace :core
resource :log endnamespace :service1 do
resource :users doresource :log, :controller => '/core/log'
end end
With the patch the 'log' nested route becomes:
:controller=>"service1//log"}
May I ask you to reopen this bug and change the patch to check if the controller's path is absolute before prepending the namespace?
Thanks.
-
José Valim April 23rd, 2010 @ 10:53 AM
- Milestone cleared.
- State changed from committed to open
So far, we did not support absolute controller paths. Could you please bring this feature request to Rails mailing list?
-
José Valim April 29th, 2010 @ 11:54 AM
- State changed from open to hold
Daniele, any news? Have you brought this topic to discussion in the mailing list?
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4351 Namespace root route not really namespaced This is similar in concept to this ticket: https://rails...
- 3673 Namespaced routes not working on Rails 3 (from [36969c6ecd69fc285bf0267805152319a4b71ceb]) Fixes n...