Putting jquery.js
in the application.html.erb
will disable the destroy/delete functionality.
Following code html code, generated from <%= link_to 'D', word_path(word), :confirm => 'A开发者_开发知识库re you sure?', :method => :delete %>
, when clicked, show
action ,instead of destroy
will be called, and no confirmation window anymore.
<a href="/words/3" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
Any ideas? Is it a bug?
In Rails3 you need to add the following tag in your to perform a delete
<%= csrf_meta_tag %>
As described in the railscast http://asciicasts.com/episodes/205-unobtrusive-javascript
Hope this helps.
<%= link_to 'D', word_path(word), :confirm => 'Are you sure?', :method => :delete %>
For this you dont need to add "word_path" just add
<%= link_to 'D', word, :confirm => 'Are you sure?', :method => :delete %>
and it will work like a charm
精彩评论