I have code like this in a Rails 3 app I'm working on
<% @positions.each do |position| %>
<tr class="<%= cycle("", "alternate") %>">
<td><%= position.name %></td>
<td class="actions">
<%=link_to 'edit', edit_position_path(position), :class => 'edit' %> |
<%=link_to 'delete', position_path(position), :confirm =&g开发者_如何转开发t; 'Are you sure you want to delete this item?', :method => 'delete' %>
</td>
</tr>
<% end %>
The edit link works fine, but the delete link keeps taking me to the show action.
Any idea what the problem is?PS: I'm using formtastic in tandem with Mongoid and ActiveRecord isn't loaded in my config/application.rb file.
Rails 3 is using unobstrusive javascript to handle delete so you may need to add the following into your layout:
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
Check out railscasts 205 to see how to use jquery instead of prototype.
精彩评论