This project is archived and is in readonly mode.
namespace nested in resource
Reported by Tomasz Bak | September 10th, 2010 @ 06:57 PM
resources :units do resources :packages, :controller => "units/packages" namespace :admin do resources :groups, :controller => "units/admin/groups" resources :packages, :controller => "units/admin/packages" do resources :share_packages, :controller => "units/admin/share_packages" end end end
This seems correct (works in development mode Rails 3.0.0), but
causes exception in production mode:
"ActionController::RoutingError (uninitialized constant
Admin::Units):"
I dont know how to fix it other then this little trick with "resource":
resources :units do resources :packages, :controller => "units/packages" resource :admin do resources :groups, :controller => "units/admin/groups" resources :packages, :controller => "units/admin/packages" do resources :share_packages, :controller => "units/admin/share_packages" end end end
Comments and changes to this ticket
-
Andrew White September 12th, 2010 @ 01:04 AM
- State changed from new to invalid
- Importance changed from to Low
The namespace option nests the controller class whereas the resource call doesn't. In production mode the app path is eagerly loaded triggering the error. If you don't want the nested class then pass in nil for the module option:
resources :units do resources :packages, :controller => "units/packages" namespace :admin, :module => nil do resources :groups, :controller => "units/admin/groups" resources :packages, :controller => "units/admin/packages" do resources :share_packages, :controller => "units/admin/share_packages" end end end
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>