I had some code from Rails 7.0.4 running with
“@hotwired/stimulus”: “^3.1.0”,
“@hotwired/turbo-rails”: “^7.1.3”,
The gist of it was deleting a resource with a custom confirm, copped from a blog post. It worked great! I moved the same link to a different App, running Rails 7.0.4 and
“@hotwired/stimulus”: “^3.2.1”,
“@hotwired/turbo-rails”: “^7.2.4”,
But the link code no longer works at all. Basically, none of the Turbo events trigger. So my Stimuaus controller is named fine, and so I was thinking this little ditty would just, but nope. My delete link just deletes the resource, happy as a clam, and no confirm ever pops up. Has something changed during these updates and I am just missing out on those changes, making this code broken?
This link works, ie) a confirm from the browser pops up:
<%= link_to "Delete School", "#", data: { "turbo-method": "delete", "turbo-confirm": "Are you sure you want to delete the school?" } %>
But this one, ignores Turbo and just deletes the resource! Why?
<%= link_to "Delete Turbo Style", "#", data: { 'turbo-method': "delete", 'school-target': "link", action: "turbo:click->school#captureClick turbo:before-fetch-request@document->school#deleteAndHide" } %>
I must be blind. Not getting it. Nothing in my stimulus controller gets hit. No captureClick or deleteAndHide.
I am frustrated!