Rails 4 link_to Destroy not working in Getting Started tutorial

Try this

<%= link_to 'Destroy',  post,  method: :delete, data: { confirm: 'Are you sure?' } %>

Make sure gem 'jquery-rails' is in gemfile and jquery_ujs is included in app/assets/javascripts/application.js file

//= require jquery
//= require jquery_ujs

Source: https://github.com/rails/jquery-ujs


I had the same issue, for rails 4.2.X. Checked all my javascript files but could not make it work. if u look closely at the server request u will be missing 'authenticity_token' in the params, so user gets logged out. In rails 4.1 and above u have to use button_to instead of link_to