我有以下路由块,并想为GET
添加charges/:id
处理程序。
resources :charges, only: [:index, :create] do
member do
post :capture
end
end
我已尝试将root :index
添加到member
块,但这不起作用..
答案 0 :(得分:3)
你在这里尝试的是这里提到的节目动作:
guides.rubyonrails.org/routing.html#crud-verbs-and-actions
在routes.rb中尝试:
resources :charges, only: [:show, :index, :create] do
member do
post :capture
end
end