开发者

about rails route

if i use

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

it will match the url helpcenter/hh/logout

my question is ho开发者_如何学Gow to let these method mapping to the url /hh/logout didn't contains the module name


You can use a scope to achieve this:

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

This will generate a mapping for /articles, /articles/new etc and not helpcenter/articles. It will however still route to the articles controller in the helpcenter namespace. e.g.: app/controllers/helpcenter/articles_controller.rb

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜