Phenomenon that cannot log out even though it is described in devise

Introduction

I introduced devise and implemented the user management function, but I encountered an unexpected error, so I will record it.

error contents

Routing Error No route matches [GET] "/users/sign_out"

<%= link_to 'Logout', destroy_user_session_path, method: :delete, class: :logout %>

Of course, it was also described in the view file as method:: delete. For some reason, the HTTP method was locating for GET in the routing.

Restart the local server

At the terminal 「control + c」 input. Run "rails s" in the terminal again

Rough technique! ??

config/initializers/devise.rb/Line 269


config.sign_out_via = :delete

Change : delete to: get.

Finally

I still don't understand why this error occurred, even though the description is correct. Even if the description is exactly the same, an error may or may not occur.

Recommended Posts

Phenomenon that cannot log out even though it is described in devise
A small story that is sometimes useful in Maven
Phenomenon that cannot log out even though it is described in devise
A story that suffered from a space that does not disappear even if trimmed with Java The cause is BOM
[Discussion] Why is System.out (in, err) initialized with null even though it is a constant?
Directory is not created even if directory task is described in Rakefile
[rails] Problems that cannot be registered / logged in with devise
Solved the phenomenon that "Response time is too long" in the original domain even though the IP address and EC2 address can be entered in the site.
Like function The part that is stuck in making it asynchronous
Phenomenon that HTTP becomes GET even if method:: delete in link_to method
Isn't it reflected even if the content is updated in Rails?
An active hash that can be treated as data even if it is not in the database
Even though the property file path is specified in the -cp option, it is not recognized as a classpath.