My app has Tickets, and a ticket can be “resolved”. I can POST via AJAX to the :resolve action with no issues, but I cannot POST via a normal HTML form. I get No route matches "/tickets/321/resolve". Both the HTML form and the JS point to the same exact URL. What am I doing wrong?
Routes:
resources :tickets do
post :resolve, :on => :member
end
Controller:
def resolve
resource.resolved!
respond_to do |wants|
wants.html { redirect_to :back }
wants.js
end
end
Form:
= form_for(ticket, :url => resolve_ticket_path(ticket)) do |f|
...
Actually when you are trying to send your form with exists resource (ticket) rails by default will send
PUTrequest, so you should set:method => :postclear or change route fromto