Skip to content
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

link_to method: :put or :delete or :post did not working on rails 7 #41

Open
x1wins opened this issue Feb 12, 2024 · 2 comments
Open

link_to method: :put or :delete or :post did not working on rails 7 #41

x1wins opened this issue Feb 12, 2024 · 2 comments
Labels

Comments

@x1wins
Copy link

x1wins commented Feb 12, 2024

Rails 7 did not support ujs anymore, Therefore link_to did not working with :put, :delete, :post method.

There is many issue such as logout of link_to using :delete method on Device gem, so on.

Many answer on stackoverflow that shown use link_to data: {"turbo-method": :post} instead of link_to method: :post

Below of code is git log for unsovled link using link_to with :put method

-            <%= link_to t('undo'), simple_discussion.unsolved_forum_thread_forum_post_path(@forum_thread, forum_post), method: :put %>
+            <%= link_to t('undo'), simple_discussion.unsolved_forum_thread_forum_post_path(@forum_thread, forum_post), data: {"turbo-method": :put} %>

Could I do PR for solving this issue on rails 7 without ujs?
Or Do you have some solution?

@excid3
Copy link
Owner

excid3 commented Feb 12, 2024

These should be changed to button_to so they don't require JavaScript. If you want to make a pull request, please do!

@excid3 excid3 added the bug label Feb 12, 2024
@x1wins
Copy link
Author

x1wins commented Feb 14, 2024

These should be changed to button_to so they don't require JavaScript. If you want to make a pull request, please do!

but button_to was not pretty on view.
link_to use awesome icon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants