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
Rails 7: link_to method: :delete not working #44185
Comments
because |
|
@rafaelfranca In any case the API reference is wrong and needs to be updated, that's why I opened this issue: https://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to In my original post:
|
It was already updated. See https://edgeapi.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to |
I face the same problem with Rails 7.0.2.3
|
Sorry I bothered you. Everything works if I run: |
I confirm, it's work also if I run that. |
yes it worked , thank you .. |
to add if anyone else struggling. The following worked with me using the following set up
First do this
you may have to do this first if you get errors:
make sure you are using example of working code. |
what if I don't wanna use turbo in my legacy code? |
I think that you can still use Rails UJS... I also prefer that because I am not using Turbo. Currently Rails UJS is not deprecated and I hope that they will keep it. |
could You tell me how to accomplish that with esbuild setup? I've tried passing this into application.js
but linkt_to with |
Hey there, I tried those steps, but rails 7.0.3.1 looks to don't have the
as an additional info, I'm kind of new with RoR.
and was created like this: any other clue or tip to solve the issue? |
I was able to resolve the issue following this other steps:
now |
it worked for me |
I was following the free code camp Rails course and came upon this issue. Doing the above seems to have fixed it. Thanks! |
I had the same issue and fixed it by adding |
…ails importmap:install $ rails turbo:install stimulus:install as per rails/rails#44185
In my case the problem was that I had turbo Drive configured to work on a per element basis in my application.js, as shown here: https://turbo.hotwired.dev/handbook/drive but I was struggling to get the Until I tried this, and it worked:
In which case, the "turbo true" part is not necessary and this works: |
Encountered the issue in 7.0.4.3 but it turned out I had to run ./bin/dev because |
i can confirm this work! tq |
I met the same problem and added this line into application.html.erb file to solve it . and it works fine |
Аll is good on Rails 7.0.8 just use gem 'turbo-rails' in your gemfile use the import '@hotwired/turbo-rails' in yaou application.js and write command yarn add @hotwired/turbo-rails or write in dependencies in to your package.json dependencies: { "@hotwired/turbo-rails": "^8.0.0-beta.1" } it's work for me. And use <%= link_to 'Delete', question_path(question), data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>. But i am create prod with -skip-hotwire. If you are have problems write the comments to me |
This works for me. Why is that? |
In case this can help anyone else using devise: We encountered this problem on a log out link. We are using devise for auth, and not using turbo. Importing Rails ujs and specifying "delete" in the link did work, but we didn't want to have to import Rails ujs just for this. |
Steps to reproduce
Example:
The API docs for Rails 7 clearly state that you can use
method: :delete
, there are even some examples.Expected behavior
A DELETE request is made.
Actual behavior
A GET request is made (i.e.
method: :delete
is ignored)System configuration
Rails version: 7.0.1
Ruby version: 3.1
Related issues
This issue is similar, but not the same: #44170
This issue is about
method: :delete
which does not work.The linked issue is about a wrong redirect when you use
'turbo-method': :delete
.The text was updated successfully, but these errors were encountered: