[Rails 6] method :: delete cannot be used with link_to

problem

<% = link_to'logout','logout_path, method:: delete%> Click the link No route matches [GET]'/ login' is displayed. ↓ The request has been sent by Get instead of Delete. ↓ If you check the HTML, you can see the description of data-method =" delete " in the corresponding a tag.

The solution I found by google

None of the following has changed

--Load jquery_ujs with app/javascripts/packs/application.js --Modify the js file reading part in the head --Add gemjquery-rails

First aid

After changing link_to to button_to, method:: delete now works. But I still want to use link_to.

How it worked

$ yarn remove @fullhuman/postcss-purgecss

After deleting the npm library called postcss-purgecss, which I introduced but eventually stopped using, method:: delete came to work.

Recommended Posts

[Rails 6] method :: delete cannot be used with link_to
[Rails] "pry-rails" that can be used when saving with the create method
Because getSupportLoaderManager cannot be used
[Rails] Specify format with link_to
[rails] Problems that cannot be registered / logged in with devise
CentOS7 VirtualBOX yum cannot be used
[PHP] Solved "mb_strpos cannot be used"
[Rails 6] MySQL 2 cannot be bundle install
What to do if JavaMail cannot be used with OpenJDK 11 or later
[Rails] Rails new cannot be done from Docker
[Rails] Posts cannot be deleted when commented! ??
Rails g devise: install cannot be executed!
Non-static method of 〇〇 Cannot be statically referenced
Rails server cannot be started in Cloud9
rails method
Ruby array methods that can be used with Rails (other than each)
[Rails] How to operate the helper method used in the main application with Administrate
Rails error messages cannot be translated into Japanese
Organize methods that can be used with StringUtils
[Ruby] Methods that can be used with strings
Why Java String typeclass comparison (==) cannot be used
Rails delegate method
Please note that Spring Boot + Tomcat 8.5.8 cannot be used!
Systemctl cannot be used on Ubuntu inside Docker container
[Ruby on Rails] Delete s3 images with Active Strage
How to delete a new_record object built with Rails
Range where variables can be used with ruby [Scope]
Scala String can be used other than java.lang.String method
[Spring Data JPA] Can And condition be used in the automatically implemented method of delete?