路由不匹配[GET] "/users/sign_out.user">
!!!
%html
%head
%title MyBascamp1
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "application", media: 'all', "data-turbolinks-track": "reload"
这是正文部分(更多细节;)
%body
- if user_signed_in?
= link_to "Log out", destroy_user_session_path, method: :delete
= yield
你有两个不同的问题。在你的项目中缺少一些配置步骤,你需要使用data-turbo-method
而不是method。使用以下命令更新link_to
= link_to "Log out", destroy_user_session_path, 'data-turbo-method': :delete
<<p>配置步骤/strong>添加rails-ujs
到application.html.haml
头
= javascript_include_tag "rails-ujs"
添加rails-ujs
预编译到app/config/initializers/asserts.rb
Rails.application.config.assets.precompile += %w( rails-ujs.js )