I was migrating a system rail2 to rails3, and got a problem when I tried to delete a item from a list. I just clicked the delete link, then session was destroyed and item was not destroyed. That problem happened in all controllers and with all three session stores. I deleted gems except rails and mysql2 and tried it but result was same. I emptied destroy actions of session stores but that was happened too. Btw, if I didn’t use session, the item was destroyed.
view:
<%= link_to image_tag("icons/10.png" ,:size => "20x20", :alt => "show", :border => 0, :class => "show"), admin_info_path(info) -%>
<%= link_to image_tag("icons/2.png" ,:size => "20x20", :alt => "edit", :border => 0, :class => "edit"), edit_admin_info_path(info) -%>
<%= link_to image_tag("icons/9.png" ,:size => "20x20", :alt => "delete", :border => 0, :class => "delete"), admin_info_path(info), :confirm => 'Are you sure?', :method => :delete %>
Gemfile:
gem 'rails', '3.0.9'
gem 'mysql2', '~> 0.2.6'
gem "settingslogic", "~> 2.0.6"
gem 'jpmobile', '0.1.6'
gem "kaminari"
gem "memcache-client"
This is almost always a result of request forgery protection. Make sure you have
<%= csrf_meta_tag %>and a workingrails.jsorjquery_ujs.jsJavaScript include inside the<head>tag of your layout.<%= javascript_include_tag :defaults %>will usually include these files automatically.If you’re still having trouble, you can always comment out the
protect_from_forgerycall (probably inside yourapplication_controller.rbfile) just to see if that is what is causing your problem. But I wouldn’t recommend turning off forgery protection permanently for security reasons.