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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -