我有这个方法将值发布到“/ store / add_to_cart”
<form action = "/store/add_to_cart" method="post">
<% for product in @products -%>
<div class = "entry">
<%= product.title %>
<%= product.price %>
<p>
</div>
<% end %>
<%= select( "payment", "id", { "Visa" => "1", "Mastercard" => "2"}) %>
<%= submit_tag 'Make Order' %>
</form>
在/store/add_to_cart.html.erb中,我创建了:
<%= params.length %>
<% for i in params%>
<%=i%>
<br/>
<% end %>
但是我收到了这个错误: StoreController中的ActionController :: InvalidAuthenticityToken#add_to_cart
发生什么事了?但是在我把它改成get方法之后,我可以得到所有的参数,wt会发生吗?