I'm trying to make a list row that is clickable, but have a delete button inside of it.
When I click Delete, the confirmation alert shows up correctly, but then it just redirects to the page that the row is linked to, without deleting the record.
<li>
<%= link_to project_path(@project) do %>
...truncated
<%= @project.name %>
...truncated
<%= button_to @project, method: :delete, data: { confirm: @confirm } do %>
<%= 'Delete' %>
<% end %>
<% end %>
</li>
I have tried adding onclick: "event.stopPropagation();",
which deletes the record, but now it doesn't show the confirmation dialog anymore.
Is it possible to do this without doing anything too custom outside UJS/turbo/hotwire?