match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
我如何将它定向到我的 :admin 命名空间?我必须在命名空间声明中定义匹配吗?
match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
我如何将它定向到我的 :admin 命名空间?我必须在命名空间声明中定义匹配吗?
您可以在使用控制器生成器时使用 / like:
match '/submit_expense/:id' => 'admin/expenses#submit_expense', :as => 'submit_expense'
在routes.rb
这可能工作......
namespace :admin do
match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense'
end
你也可以to:
像这样使用指令:
get '/submit_expense/:id', to: 'admin/expenses#submit_expense'