I am working on rails 7. I'm trying to run my 'Delete' method after disabling 'Turbo' but its not working, it keeps getting to my 'show.html.erb' file instead of deleting the specific data. Here is my 'Delete' action code:
<td>
<%= link_to 'Delete', friend_path(friend), data: { turbo:false ,confirm: 'Are you sure?'}, method: :delete, :class=>"btn btn-danger"%>
</td>
And below is the controller method to destroy/delete data:
def destroy
debugger
@friend = Friend.find(params[:id])
@friend.destroy
if @friend.destroy
redirect_to friends_path, notice: "Deleted Successfully!!!"
else
render :index, status: :unprocessable_entity
end
end