Rails HTML请求:发布但是执行:获取

时间:2014-03-02 02:32:24

标签: ruby-on-rails ruby-on-rails-3 post get request

我有一些参加/退出比赛的代码:

<% if @competition.users.exclude?(@user)  %>
  <%= link_to 'Attend Competition', attend_competition_path(@competition.id), :method => :post %>
<% else %>
  <%= link_to 'Withdraw', withdraw_competition_path(@competition.id), :method => :post %>
<% end %>

当我点击操作时,我会转到错误页面:

No route matches [GET] "/competitions/1/withdraw"

为什么不执行POST请求?我该如何解决这个问题?

不确定它是否会影响它,但我当前的js是

//= require jquery
//= require bootstrap
//= require turbolinks
//= require_tree .

感谢

0 个答案:

没有答案