quirky rails routing不尊重表单或配置参数

时间:2017-12-10 15:18:32

标签: ruby-on-rails

rake routes显示

create_multiple_allotments POST   /allotments/create_multiple(.:format)                allotments#create_multiple

表单调用

<%= form_tag create_multiple_allotments_path, :method => :post do %>

然而,提交表单自行完成:

Started GET "/allotments/create_multiple? [...]
Processing by AllotmentsController#show as HTML

路线定义

  resources :allotments do
    collection do
      post  :create_multiple
    end
  end

为什么rails坚持要搞定?

1 个答案:

答案 0 :(得分:0)

找出问题的根源。

表单错误地是前面指定的get方法。更改了路由和表单。但是浏览器缓存已经提供并仍在发送旧设置。

...傻