Question

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

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top