0
無論我嘗試了多少種解決方案,沒有任何工作。確認彈出窗口不會生成,並且每次只會發送一次GET。link_to:方法和確認:不工作
我已經試過這兩種格式都做同樣的事情(什麼)
%li= link_to 'Log out', destroy_user_session_path, method: "delete", data: {confirm: 'Are you sure?'}
%li= link_to 'Log out2', {controller: "users/sessions", action: "destroy"}, confirm: "Are you sure?"
這裏是生成的HTML:
<a data-confirm="Are you sure?" rel="nofollow" data-method="delete" href="https://stackoverflow.com/users/sign_out">Log out</a>
的application.js
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
$(function(){ $(document).foundation(); });
application.html.haml
= stylesheet_link_tag "application"
= javascript_include_tag "vendor/modernizr"
= javascript_include_tag "application" 'data-turbolinks-track' => true
= csrf_meta_tags
當您運行'rake routes'時,是否將「destroy_user_session」與動詞「DELETE」一起列出? – digijim