link_to delete url is not working

前端 未结 7 1450
一个人的身影
一个人的身影 2020-12-06 00:15

I have the following link_to delete url in my app

<%=link_to \"Delete\",blog_path(@blog.id), :method => :delete, :class => \"delete\", :confirm =>         


        
7条回答
  •  清歌不尽
    2020-12-06 00:25

    You can try with 'data-method' instead of :method.

    <%=link_to "Delete",blog_path(@blog.id), 'data-method' => :delete, :class => "delete", :confirm => "Are you sure ?"%> 
    

    You can check on jquery_ujs.js the following piece of code:

    // Handles "data-method" on links such as:
    // Delete
    

提交回复
热议问题