routing - Rails 3 link_to (:method => :delete) not working -
i'm having trouble verbs in rails...
viewing page resource (dog) has_many (fleas). embedded in dog's show.html.haml call render @dog.fleas automatically(?) finds & uses template in "fleas/_flea.html.haml" list each flea associated said dog.
this displays correctly. whew! now, next each flea i've put "kill flea" link goes url: //localhost:3000/dogs/1/fleas/7. generated by:
= link_to("kill flea", [ flea.dog, flea ], :method => :delete, :confirm => "sure? bunny die") but every time link clicked there no confirmation... , renders flea's show.html page. it's if it's using get on /dogs/1/fleas/7 instead of delete?!?
ps- not worried spiders & robots deleting things in database... i'm trying learn rails..and understand what's happening
rails 3 uses unobtrusive javascript now. in rails 2.3, erb shove messy javascript right link itself, in onclick event. javascript has been moved out of link, , external js files. make sure have in layout:
<%= javascript_include_tag :all %> if have this, there might deeper problems keeping javascript running, place start. let me know how turns out.
Comments
Post a Comment