I have two models: site, and heading, site has_many headings.
I have a destroy link:
<%= link_to site_heading_path(@site, @heading), data: { 'turbo-method': :delete, 'turbo-confirm': "Are you sure?"} do %>
<i class="ti ti-trash"></i> Destroy
<% end %>
Here's my headings controller method, it's basically just the stock action:
def destroy
@heading.destroy
respond_to do |format|
format.html { redirect_to site_path(@site), notice: "Heading was successfully destroyed." }
format.json { head :no_content }
end
end
I've written this code a thousand times, but for some reason in my barebones new Rails 7 codebase it is doing something wonky.
Expected:
Heading is deleted, i'm redirected to /sites/1
Actual Behavior:
- Heading is deleted (good)
- I can see the redirect (good)
- TURBO_STREAMS for some reason calls DELETE on
/sites/1(very bad)
I have no idea why this would happen.
Here is the webrick output. You can see it tried to delete the site too. I don't know why..
