Rails link_to method:: delete
Eu sinto muito por perguntar o que pode ser uma pergunta corretiva, mas no rails de aprendizado eu estava tentando acompanhar a nota por nota neste tutorial:
http://guides.rubyonrails.org/getting_started.html
Eu postei uma pergunta semelhante a partir deste tutorial na noite passada e recebi uma resposta imediata que me ajudou significativamente, então estou esperando o mesmo. Agradeço antecipadamente.
Seção 5.14: Excluindo Posts
Fui instruído a adicionar um link de exclusão à página index.html.erb
<h1>Listing Posts</h1>
<table>
<tr>
<th>Title</th>
<th>Text</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @posts.each do |post| %>
<tr>
<td><%= post.title %></td>
<td><%= post.text %></td>
<td><%= link_to 'Show', post_path %></td>
<td><%= link_to 'Edit', edit_post_path(post) %></td>
<td><%= link_to 'Destroy', post_path(post),
method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
que gera:
<td><a data-confirm="Are you sure?" data-method="delete" href="/posts/1" rel="nofollow">Destroy</a></td>
Parece bom para mim, mas quando clico no link não recebo nem a confirmação nem sou direcionado para a ação de exclusão. Ele gera esta ação HTTP
Request URL:http://localhost:3000/posts/1
Request Method:GET
Status Code:200 OK
Rails: 4, Ruby: 2, janelas de 64 bits 8, chrome: versão 28.0.1500.72 m
Obrigado novamente
Adicionando o application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Listing</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag :application %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
que produziu este erro:
ExecJS :: RuntimeError em Posts # index Exibindo C: /Ruby-Projects/listing/app/views/layouts/application.html.erb onde a linha 6 foi criada:
(em C: /Ruby200-x64/lib/ruby/gems/2.0.0/gems/turbolinks-1.3.0/lib/assets/javascripts/turbolinks.js.coffee) Fonte extraída (em torno da linha # 6): 3 4 5 6 7 8 9 Listagem <% = stylesheet_link_tag "application", media: "todos", "data-turbolinks-track" => true%> <% = javascript_include_tag: aplicativo%> <% = csrf_meta_tags%>
Rails.root: C: / Ruby-Projetos / listagem
Rastreamento de Aplicativo | Rastreamento de Estrutura | Aplicativo de rastreamento total / views / layouts / application.html.erb: 6: em `_app_views_layouts_application_html_erb___567964991_28724900 'Request
Parâmetros:
Nenhum
application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .