This project is archived and is in readonly mode.
namespaced controllers routing - params and url_for
-
Nataniel
I'm working with edge.
-
Repository
- State changed from new to resolved
(from [b802a0d4c72fbd605b92e9f403c9b8765a6e480c]) When a dynamic :controller segment is present in the path add a Regexp constraint that allow matching on multiple path segments.
Using a namespace block isn't compatible with dynamic routes so we
raise an ArgumentError if we detect a :module present in the scope.[#5052 namespaced controllers routing - params and url_for state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/b802a0d4c72fbd605b92e9f403c9b8... -
Nataniel
- Assigned user set to José Valim
Now, following entry in routes.rb is forbidden:
namespace :admin do match ":controller(/:action(/:id))", :id => /\d+/ endSo is there any way to use modules with defaults routes? In my app I have few modules, like admin/, site/, api/ and I don't want to mix the controllers together - do I have to declare each controller in routes.rb to achieve it?
-
José Valim
- Importance changed from to Low
Nataniel,
You should just invoke call without namespace:
match ":controller(/:action(/:id))", :id => /\d+/However, if you want to allow just admin controllers, you can dan do something like this:
match ":controller(/:action(/:id))", :id => /\d+/, :controller => /admin\/.+?/ -
Nataniel
Thanks a lot, it's all clear and working great now!