If I want to make a DELETE link in rails, I will write the following code (in this example, to delete a user session in Devise):
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
This will turn into the following HTML:
<a rel="nofollow" data-method="delete" href="/users/sign_out">Logout</a>
Works fine, but I can't just put this HTML in a static HTML page. It will simply execute the GET request. I assume Rails includes some standard Javascript to turn the above link into one that actually executes a DELETE request. So, what is the correct way to have a link in a static HTML page to a Rails resource that performs a DELETE action? Should I find and capture Javascript Rails on all web pages that do this? Is there a better way?
source share