Rails:同一路径的GET和POST路由会导致ArgumentError

时间:2019-03-11 00:56:54

标签: ruby-on-rails ruby-on-rails-5

当我访问/contact时,我得到:

ArgumentError (wrong number of arguments (given 1, expected 0)):
app/controllers/contact_controller.rb:6:in `send'

以下是config/routes.rb的内容:

Rails.application.routes.draw do
  root to: 'home#index'  
  get  'contact', to: 'contact#index'
  post 'contact', to: 'contact#send'
end

在同一路径中同时包含getpost的路由是否会导致get不被使用? ContactControllerindexsend的操作为空,但是index似乎被忽略了。

0 个答案:

没有答案