I have the following link_to delete url in my app
<%=link_to \"Delete\",blog_path(@blog.id), :method => :delete, :class => \"delete\", :confirm =>
In order for link_to
to work with the delete
method, Rails needs the unobtrusive scripting adapter for jQuery.
Make sure that your Gemfile has
gem 'jquery-rails'
Make sure that app/assets/javascripts/application.js has
//= require jquery
//= require jquery_ujs
Make sure that your app/views/layouts/application.html.erb has
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
inside the head
tag. Remove the 'data-turbolinks-track' => true
section if you don't plan to use Turbolinks.