I have a Document, and Document has many Pages. On the Document show, you can click a button to delete the page. That button looks like:
= link_to 'Delete', [:super_user, page], data: { turbo_confirm: 'Are you sure?', turbo_method: :delete }
This page also has
= turbo_page_requires_reload
Because I need to break out of a modal that's used for editing the Document. That modal is loaded in a Turbo Frame.
When you click the delete button, it destroys the Page and redirects back to the Document show, but the flash message doesn't appear.
If I disable Turbo, the flash works, but the confirm message does not.
If I remove turbo_page_requires_reload
, then the modal no longer breaks out of the frame.
It seems like maybe going back to rails_ujs might give me back the ability to disable Turbo and also get a confirm message, but that seems hacky and/or a step backwards.
I've tried changing the status code of the response on the destroy, the only thing that works is changing it to :unprocessable_entity
, but that just seems hacky.
How can I get this working as expected?