我正在尝试找出 Ruby on Rails 路由问题。这是 routes.rb 文件的相关部分:
resources :clients do
resources :campaigns do
resources :targets do
member do
post 'send'
end
end
end
end
rake routes
包括:
send_client_campaign_target POST /clients/:client_id/campaigns/:campaign_id/targets/:id/send(.:format) targets#send
但是,一个 POST/clients/1/campaigns/1/targets/30/send
返回以下错误:
ArgumentError in TargetsController#send
wrong number of arguments (2 for 0)
错误页面显示参数为:
{"client_id"=>"1",
"campaign_id"=>"1",
"id"=>"30"}
知道有什么问题吗?我是对的,这是一个路由问题吗?目标控制器中存在 send 方法,但它是一个空的存根方法,并且仍在生成此问题。
谢谢!