Support
Quality
Security
License
Reuse
Coming Soon for all Libraries!
Currently covering the most popular Java, JavaScript and Python libraries. See a SAMPLE HERE.
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
jQuery JavaScript Library
default
In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:
1. [Getting Involved](https://contribute.jquery.org/)
2. [Core Style Guide](https://contribute.jquery.org/style-guide/js/)
3. [Writing Code for jQuery Foundation Projects](https://contribute.jquery.org/code/)
Environments in which to use jQuery
QUESTION
Rails 7 - link_to with method :delete still performs GET request
Asked 2022-Feb-10 at 18:02I am trying to get this link to work, performing a DELETE
request:
<%= link_to "Sign Out", destroy_user_session_path, method: :delete %>
However when I click on it, my browser still performs a GET
request (which fails for obvious reasons):
I have read on multiple other forum posts, that this might have something to do with jquery not being included. They mentioned you would need to un-comment a line in app/javascript/application.js
, however mine is pretty empty:
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "@hotwired/turbo-rails"
import "controllers"
These forum posts were also quite old, so I suspect something has changed in the meantime.
ANSWER
Answered 2021-Dec-25 at 22:28As suggested here, the following will suffice:
<%= link_to "Sign Out", destroy_user_session_path, data: { "turbo-method": :delete } %>
I have tested this in my project and it seems to work fine. Thanks also to @alexts, you basically figured this out too, however the comment on GitHub even eliminated the double-request.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported