Home > Enterprise >  application.html.haml Ruby on Rails
application.html.haml Ruby on Rails

Time:07-15

No route matches [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"

This is body section(more details ;)

%body
- if user_signed_in?
  = link_to "Log out", destroy_user_session_path, method: :delete
= yield

CodePudding user response:

You had two different problems. There were some missing configuration steps on your project and you need to use data-turbo-method instead of method. Update the link_to with the following.

= link_to "Log out", destroy_user_session_path, 'data-turbo-method': :delete

Configuration steps

Add rails-ujs to the application.html.haml head.

= javascript_include_tag "rails-ujs"

Add the precompile of rails-ujs to app/config/initializers/asserts.rb

Rails.application.config.assets.precompile  = %w( rails-ujs.js )
  • Related