ruby - No route matches [GET], for delete request -
i getting routing error no route matches [get]
upon delete
request. here delete route
delete '/remove/:product_id', to: 'carts#remove_product'
using
<a href="/remove/<%=subq.product.id%>" method="delete"></a>
. idea error?
as justin wood suggested, use rails' link_to helper, :
<%= link_to 'destroy', your_method_path(subq.product), :method => :delete %>
if want stick current way of doing it, try (please note data-method
instead of method
, see https://stackoverflow.com/a/35283202/4480140):
<a href="/remove/<%=subq.product.id%>" data-method="delete"></a>
and check in application.js file have
//= require jquery //= require jquery_ujs
and application.js file included view/layout/application.html.erb
file. cf https://stackoverflow.com/a/17748391/4480140
Comments
Post a Comment