-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Links with method DELETE triggering a GET #39432
Comments
This sounds like a configuration issue. Are there any error messages in the JavaScript console before you click the link? |
@jonathanhefner nothing: Again, this is a vanilla Rails project that I just started with: rails new myproject --database=postgresql --webpack=vue All config is default. |
Can you share a sample application repo on GitHub with steps you are following after |
Sure thing: https://github.com/DaniG2k/myproject I think I've found the culprit (but not yet the solution). When I add the Bulma CSS framework, the logout link stops working. I installed Bulma as follows:
then in @import '~bulma' The Bulma framework loads but the |
The application.scss file in packs directory is causing the issue, see usage here: https://github.com/rails/webpacker#usage |
The css.md link is now: https://github.com/rails/webpacker/blob/5-x-stable/docs/css.md I had this issue but couldn't find any problem with the In the end, installing jquery-ujs directly was the fix for my application. |
Thank you, it helps me |
Steps to reproduce
I have just started a simple Rails 6.0.3.1 project.
I'm setting up the Devise actions, but the logout link doesn't seem to work. It's performing a
GET
request instead of aDELETE
despite the fact that I specify the method:= link_to 'Logout', destroy_user_session_path, method: :delete
Clicking the link yields:
As far as I can tell, Rails ujs should be intercepting that and triggering a
DELETE
. Myapp/javascript/packs/application.js
is including ujs:and my
config/webpack/environment.js
:I've worked on plenty of other Rails projects in the past and have never had a problem using
method: :delete
on a link, so I'm wondering if there's an issue with ujs or if it's a configuration error on my part. As far as I can tell I have a vanilla setup so I don't see why it would fail.Expected behavior
Clicking the link with
method: :delete
should trigger aDELETE
controller request.Actual behavior
Link triggers
GET
request to controller.System configuration
Rails version: 6.0.3.1
Ruby version: 2.7.1
The text was updated successfully, but these errors were encountered: