Rails 3 link_to (:method => :delete) not working

前端 未结 6 2058
抹茶落季
抹茶落季 2020-11-30 08:13

I\'m having trouble with my verbs in Rails...

viewing a page for a resource (Dog) which has_many (Fleas). Embedded in dog\'s show.html.haml

6条回答
  •  感情败类
    2020-11-30 08:44

    Here I am not using the javascript_include_tag :all, :application etc. I am using my own js files, with another custom name: javascript_include_tag :my_custom_file and I also had this issue. And I am not using '= require jquery' in the file, but javascript/jquery is working. I think Rails includes jquery by default. What I done is I changed the

    link_to "Logout", destroy_user_session_path, :method => :delete 
    

    to

     form_tag destroy_user_session_path, :method => :delete, :id => "logout_form" 
       link_to 'Logout', "#delete", :onclick =>  "$('#logout_form').submit();"
    

    Now its working fine.

提交回复
热议问题