New Rails 7 app created in 2021 or 2022, when I click on a form with data-turbo-confirm
, the alert message does not show.
<%= form_with url: root_path(), data: {'turbo-confirm': "Are you sure you want to submit this form?"},
method: :delete do |f| %>
<%= f.submit "Delete".html_safe, class: "delete-apple-button btn btn-primary btn-sm" %>
<% end %>
<br />
<%= turbo_frame_tag "apples-list" do %>
nothing has happened yet
<% end %>
Page loads to:
When you click delete, no alert is shown:
Expected result: • Alert message confirming the button action
Actual result: • No alert is shown
This happens if you had locally installed gem versions 7.1.0 or 7.1.1 for turbo-rails
These gem numbers were pushed by accident to Rubygems in October, then yanked. However, since bundler will default to the highest number of your Rails gem when it sets up your new rails app, it will pick turbo-rails version 7.1.0 or 7.1.1 , which will display this flaw
The gems were yanked, so this only affects you if you were developing rails apps between October 2021 and the yank date.
TO FIX YOUR COMPUTER:
gem uninstall turbo-rails
Bundler will prompt you for which version to uninstall:
You will need to repeat this step if you have both gem versions installed.
Then, bundler will not make new apps with that version.
However, if you generated an app already it will be locked to the wrong version. to fix, specify version explicitly in Gemfile
gem "turbo-rails", "~> 1.0"