I have a problem that has been documented previously but for which I can't solve in my case. This is about the 5.13 section of Getting Started Rails tutorial that deals with deleting an entry.
First here is my Controller :
def destroy
@article = Article.find(params[:id])
@article.destroy
redirect_to articles_path end
My view
<% @articles.each do |article| %>
<tr>
<td><%= article.title %></td>
<td><%= article.text %></td>
<td><%= link_to 'Show', article_path(article) %></td>
<td><%= link_to 'Edit', edit_article_path(article) %></td>
<td><%= link_to 'Destroy', article_path(article), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr> <% end %>
As per this thread : Rails 4 link_to Destroy not working in Getting Started tutorial
I have amended link_to to button_to which DOES work. But this doesn't really explain why the tutorial bit doesn't work.
I have also made sure that the 'jquery-rails' gem was in the gemfile. And I checked aswell the follwing from my app/assets/javascript/application.js file:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
As per this thread Delete link sends "Get" instead of "Delete" in Rails 3 view I checked my app/views/layouts/application.html.erb file which looks like :
<!DOCTYPE html>
<html>
<head>
<title></title>
<%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head> <body>
<%= yield %>
</body>
</html>
I tried in both Chrome and Firefox. Still doesnt work.