Rails 3 vs Rails 2 "wild controller" routing
I'm trying to get my Rails 3 project to automatically resolve namespaced controllers, similar to the Rails 2 behaviour. For example (Rails 2):
$ rails pathtest && cd pathtest
$ script/generate controller First
$ script/generate controller first/second
$ script/generate controller first/second/third
$ script/server
Requests to:
But, Rails 3 yields different routing using the 'wild controllers' path.
$ rails new pathtest && cd pathtest
$ rails generate controller First
$ rails generate controller first/second
$ rails generate controller first/second/third
## config/routes.rb
Pathtest::Application.routes.draw do
match ':controller(/:action(/:id(.:format)))'
end
$ rails server
Requests to:
I'm starting to think that kind of automatic resolution of namespaced controllers isn't the way anymore? Has anyone found a way to automatically resolve namespaced controllers like this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Try this: