我有一些参加/退出比赛的代码:
<% 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 .
感谢