title: Rails link_to method: :delete
body: <p>I am sorry for asking what may be a remedial question, but in learning rails i was trying to follow along note for note in this tutorial:</p>
  
  <p><a href="http://guides.rubyonrails.org/getting_started.html">http://guides.rubyonrails.org/getting_started.html</a></p>
  
  <p>I posted a similar question from this tutorial last night and got a prompt response which helped me significantly, so I am hoping for the same.  Thank you in advance.</p>
  
  <p>Section 5.14: Deleting Posts</p>
  
  <p>I am instructed to add a delete link to the index.html.erb page</p>
  
  <pre><code>&lt;h1&gt;Listing Posts&lt;/h1&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Title&lt;/th&gt;
      &lt;th&gt;Text&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  
  &lt;% @posts.each do |post| %&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;%= post.title %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= post.text %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Show', post_path %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Edit', edit_post_path(post) %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= link_to 'Destroy', post_path(post),
                      method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;% end %&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>which generates:</p>
  
  <pre><code>&lt;td&gt;&lt;a data-confirm="Are you sure?" data-method="delete" href="/posts/1" rel="nofollow"&gt;Destroy&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>It looks OK to me, but when I click on the link I get neither the confirmation nor am I directed to the delete action.  It generates this HTTP action</p>
  
  <pre><code>Request URL:http://localhost:3000/posts/1 
  Request Method:GET 
  Status Code:200 OK 
  </code></pre>
  
  <p>Rails: 4, Ruby: 2, 64 bit windows 8, chrome: Version 28.0.1500.72 m</p>
  
  <p>Thank you again</p>
  
  <hr>
  
  <p>Adding the application.html.erb</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Listing&lt;/title&gt;
    &lt;%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" =&gt; true %&gt;
    &lt;%= javascript_include_tag :application %&gt;
    &lt;%= csrf_meta_tags %&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;%= yield %&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>which yielded this error:</p>
  
  <blockquote>
    <p>ExecJS::RuntimeError in Posts#index Showing
    C:/Ruby-Projects/listing/app/views/layouts/application.html.erb where
    line #6 raised:</p>
    
    <p>(in
    C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/turbolinks-1.3.0/lib/assets/javascripts/turbolinks.js.coffee) Extracted source (around line #6): 3 4 5 6 7 8 9
                 
        Listing
        &lt;%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
        &lt;%= javascript_include_tag :application %>
        &lt;%= csrf_meta_tags %>      </p>
    
    <p>Rails.root: C:/Ruby-Projects/listing</p>
    
    <p>Application Trace | Framework Trace | Full Trace
    app/views/layouts/application.html.erb:6:in
    `_app_views_layouts_application_html_erb___567964991_28724900' Request</p>
    
    <p>Parameters:</p>
    
    <p>None</p>
  </blockquote>
  
  <hr>
  
  <p>application.js</p>
  
  <pre><code>//= require jquery
  //= require jquery_ujs
  //= require turbolinks
  //= require_tree .
  </code></pre>