Hi,everyone:
I use form_tag create a form and nested a button_to tag like this:
<%= form_tag(orders_path) do %>
......... #some form fields
<%=button_to "remove",line_item, :method=>:delete
%>
<%= submit_tag "Checkout" %>
<% end %>
when I click "Checkout" ,the form always invokes "remove" method!
How can I solve this problem? Thanks!
Have a look at the html of the page (View > Page Source, or similar,
in the browser) and see what <form> tag you are generating. That will
show you what action should be called. Also you can look in
log/development.log to see what it says when you click submit.
Unless you have a good reason, however, I would suggest using form_for
rather than form_tag. It makes life easier generally.