anchors with delete method do not redirect
See original GitHub issueExpected Behaviour
Clicking on
<a class="text-danger" data-method="delete" data-confirm="Are you sure you want to delete this contact?" data-turbo="false" href="/sellers/2/contacts/10">Delete</a>
is expected to make a delete request to the server, where the controller action performs a redirect, and the page respond with a redirect
Controller
def destroy
@contact.destroy
flash[:success] = 'Contact Deleted'
redirect_to seller_contacts_path(current_organization)
end
Actual Behaviour
The controller action is hit and the browser receives the response to redirect, however the DOM remains unchanged
Steps to Reproduce
- Create an anchor with a delete method, confirm text and data-turbo=“false”
- Create a controller destryo action that responds with a redirect
Repo (if possible)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Is this OK to redirect to `PUT`, `DELETE` methods?
Simply create URL /users/37/delete , do all your validation here and delete it on success. If you want to have REST API, keep...
Read more >"data-turbo-method: delete" should use POST with ...
When an <a> link attributed with 'data-turbo-method: delete' is clicked turbo intercepts the click and issues a DELETE request to the server.
Read more >Send a delete request and redirect back, 405 error
I send a delete request from Front end: this.$inertia.visit('/test/100', { method: 'delete', onSuccess: () => { this.$notify.success('success') }, onEr.
Read more >Replacing anchor links with JavaScript
The solution is to use the scrollIntoView method which is supported in all major browsers. It scrolls to the (any) selected element without...
Read more >Help:Redirects
Deleting a redirect ... There's generally no need to delete redirects. They do not occupy a significant amount of database space. If a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@scottbarrow pretty sure this was due to bad querySelectors on my part.
This should be fixed now in
0.3.0.beta-29Feel free to reopen this if it doesnt fix it.
@scottbarrow pretty sure I found the issue. Pushing up a fix shortly.