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

Migrate from Rails UJS to Turbo #3429

Open
benjaminfaure opened this issue Jun 18, 2024 · 0 comments
Open

Migrate from Rails UJS to Turbo #3429

benjaminfaure opened this issue Jun 18, 2024 · 0 comments
Labels
effort-large 1-3 days of dev time

Comments

@benjaminfaure
Copy link
Contributor

Rails UJS is deprecated and will be removed in Rails 7.2 : https://edgeguides.rubyonrails.org/7_2_release_notes.html#action-view-removals

It is used in a lot of places, mainly to create links & buttons that uses POST or DELETE http methods.
Here's an example with the sign out link :

<%= link_to '<i class="fas fa-right-to-bracket" aria-hidden="true">&nbsp;</i>&nbsp;'.html_safe + _('Logout'), destroy_user_session_path, method: :delete, class: 'dropdown-item' %>

An upgrade guide is available here and is quite simple but a lot a views require changes as the data attributes needs to be changed from data-method="delete" to data-turbo-method="delete".

The above example would be :
<%= link_to '<i class="fas fa-right-to-bracket" aria-hidden="true">&nbsp;</i>&nbsp;'.html_safe + _('Logout'), destroy_user_session_path, data: {turbo_method: :delete}, class: 'dropdown-item' %>

@benjaminfaure benjaminfaure added the effort-large 1-3 days of dev time label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-large 1-3 days of dev time
Projects
None yet
Development

No branches or pull requests

1 participant