12
match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'

我如何将它定向到我的 :admin 命名空间?我必须在命名空间声明中定义匹配吗?

4

3 回答 3

26

您可以在使用控制器生成器时使用 / like:

match '/submit_expense/:id' => 'admin/expenses#submit_expense', :as => 'submit_expense'
于 2013-01-15T01:12:30.057 回答
12

routes.rb这可能工作......

namespace :admin do
  match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
end
于 2012-11-28T21:34:10.163 回答
1

你也可以to:像这样使用指令:

  get '/submit_expense/:id', to: 'admin/expenses#submit_expense'
于 2021-03-30T15:57:01.023 回答