match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
我如何将此指向我的:admin命名空间?我是否必须在命名空间声明中定义匹配?
答案 0 :(得分:20)
您可以在使用控制器生成器时使用/喜欢:
match '/submit_expense/:id' => 'admin/expenses#submit_expense', :as => 'submit_expense'
答案 1 :(得分:10)
在routes.rb
这可能会有用......
namespace :admin do
match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
end
答案 2 :(得分:0)
您也可以像这样使用 to:
指令:
get '/submit_expense/:id', to: 'admin/expenses#submit_expense'