如何创建自定义路线

时间:2019-10-16 09:16:29

标签: ruby-on-rails

我应该添加到我的routes.rb文件中

Rails.application.routes.draw do
  namespace :admin do
   ?
  end
end

要获得以下路线?

admin_user_archivals PATCH  /admin/users/:user_id/archivals(.:format)
admin/users/archivals#create

1 个答案:

答案 0 :(得分:1)

namespace :admin do
 patch 'users/:user_id/archivals', to: 'controller_name#action_name', as: 'user_archivals'
end