문제

I have some code for attending/withdrawing from a competition:

<% 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 %>

When I click on the action I go to an error page:

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

Why isn't it doing a POST request? How do I fix this?

Not sure if it effects it, but my current js is

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

thanks

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top