2010-11-10 110 views
0

如果我使用关于轨道路线

namespace :helpcenter do 
    get "hh/logout" 
    get 'hh/login' 
end 

它将匹配的网址帮助中心/ HH /注销

我的问题是如何让这些方法映射到URL/HH /注销并没有包含模块名称

+0

不太了解你的问题。你想实现什么?你能否详细说明一下? – 2010-11-10 02:32:40

+0

所以你想匹配'/ hh/logout'到'herlpercenter_controller'或'helpercenter :: hh_controller'或'hh_controller'?你的原始案例将使用'helpcenter :: hh_controller' – PeterWong 2010-11-10 02:57:19

回答

0

您可以使用范围来实现这一点:

scope :module => 'helpcenter' do 
    resources :articles 
end 

这将产生映射,/articles/new等而不是helpcenter/articles。但是,它仍然会转到帮助中心命名空间中的文章控制器。例如:app/controllers/helpcenter/articles_controller.rb

希望有帮助。