Support "Method Not Allowed" on resources

HTTP status code "405 Method Not Allowed" (HTTP/1.1: Status Code Definitions) is used when a client tries to use a verb on a resource and it is not supported. Along with the 405, the client should receive a list of support verbs in the "Allow" header of the response. If the controller only has "show" and "update" actions and someone tries to call destroy with the "DELETE" verb then they should receive a 405 with "Allow: GET, PUT" header.

I've be working on a patch (Parked at Loopia) and it seems to work fine. I just don't like the implementation of it. Seems like it could be done much cleaner.

Could someone clean up my patch a little or is this whole "Method Not Allowed" thing a bad idea?

I've be workin Parked at Loopia

I've be workin Parked at Loopia

Why don't you just move this to a plugin for now? I'm all for supporting HTTP and all that. I'm just afraid this wouldn't get used much in Rails, which begs the question: Why include it? At the very least, this will give you freedom to make modifications at your leisure. A series of patches through pastie or trac does not make a very good SCM substitute.

Believe me, I know :slight_smile:

http://dev.rubyonrails.org/ticket/1758

Though sometimes it takes a bit to drill that notion into my head...

http://dev.rubyonrails.org/ticket/1974

I think your right. It might have some undesirable affects if you don't really care about resources or http.

I still think its a "core" feature but I think I'm overlooking more situations I haven't tested yet.