1

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

jvperrin
  • 3,368
  • 1
  • 23
  • 33
Marcus
  • 9,032
  • 11
  • 45
  • 84

0 Answers0