我有路线
post '/request/:payment_system' => 'new_domain/accounts#withdraw_request', constraints: { payment_system: /webmoney|visa|mastercard|bank|qiwi|ym|neteller|skrill/ }
和form_tag
form_tag({ action: :withdraw_request}) do
我的控制器动作
class NewDomain::AccountsController < ApplicationController
def withdraw_request
some code here
end
end
但我有
No route matches {:action=>"withdraw_request", :controller=>"new_domain/accounts"
如何解决?
答案 0 :(得分:0)
假设您需要一个收集路线,请将此代码放入您的routes.rb:
namespace :new_domain do
resources :accounts, only: [] do
collection do
get :withdraw_request
end
end
end
答案 1 :(得分:0)
form_tag({ action: :withdraw_request}) do
它将使'/ request /:payment_system'无效,payment_system值在哪里以及/ request在哪里?
如果你真的想要对withdraw_request发出POST请求,你需要制作一个集合。