link_to with :method => :delete
is performing a GET request when Turbolinks are enabled. As soon as I disable Turbolinks it works again. I've exhausted my research into possible solutions including:
1) Made sure the helper is producing the correct HTML
<a data-confirm="Are you sure?" rel="nofollow" data-method="delete" href="/admin/organizations/1">Delete</a>
2) Tried it with Turbolinks enabled and data-no-turbolinks
on the link
3) Ensured jquery and jquery-ujs are both being loaded
<script src="/assets/jquery/dist/jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/jquery-ujs/src/rails.self-d456baa54c1fa6be2ec3711f0a72ddf7a5b2f34a6b4f515f33767d6207b7d4b3.js?body=1" data-turbolinks-track="true"></script>
4) Tried it with and without jquery.turbolinks
5) Ensured there are no javascript errors in the console
6) Made sure js file is loaded in the head with data-turbolinks-track
(It's the only javascript include)
javascript_include_tag "application", "data-turbolinks-track" => true
7) Checked routes and request logs (GET is being performed instead of DELETE)
21:56:40 web.1 | Started GET "/admin/organizations/1" for 127.0.0.1 at 2015-11-17 21:56:40 -0500
8) Ensured $(document)
is bound to 'page:change'
I do not want to use button_to
(which does work). Any other suggestions would be greatly appreciated.
It was a call to e.stopPropagation() on a click handler in a js file. I have no idea why that was causing the problem, I have other calls to stopPropagation and this was on a different portion of the page (header) than where the delete link was being called (main body). So solved but still confused.