I follow this reference Delete link sends Get request instead of Delete Rails 7
But looks like It is not working for me
I have this link inside a turbo_frame
<%= link_to t("delete"), post_path(post), method: :delete, class: "font-medium text-red-600 underline hover:no-underline hover:text-red-500", data: { confirm: t("are_you_sure") , turbo: false } %>
And the confirm is not appearing and also the request is a GET
I tested adding a byebug on the destroy action and is not triggered when I press the link.
Instead this works
<%= link_to t("delete"), post, method: :delete, class: "font-medium text-red-600 underline hover:no-underline hover:text-red-500", data: { turbo_confirm: t("are_you_sure"), turbo_method: :delete } %>
But I need a full page redirect in order to redirect users to the posts_path
Ideas why the confirm and the disable turbo is pointing to the GET an not to the delete ?
Here is the post_controller destroy method
def destroy
@post.destroy
respond_to do |format|
format.html { redirect_to posts_url, status: :see_other }
end
end
button_todata: {turbo_frame: "_top"}turbo.hotwired.dev/reference/…