I’d like to create a link in a view within a Rails application that does this…
DELETE /sessions
How would I do that.
Added complication:
The ‘session’ resource has no model because it represents a user login session. CREATE means the user logs in, DESTROY means logs out.
That’s why there’s no ID param in the URI.
I’m trying to implement a ‘log out’ link in the UI.
Correct, browsers don’t actually support sending delete requests. The accepted convention of many web frameworks is to send a _method parameter set to ‘DELETE’, and use a POST request.
Here’s an example in Rails:
You may want to have a look at Restful Authentication.