When and Where does is the Method Override parsed?

I’m trying to figure out when and where the method override is parsed and dealt with.

This works

curl ‘http://www.whatsayye.com/questions/3.json’ \

    -X "POST" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "X-HTTP-Method-Override: PUT" \

    -d "{ \"question\": { \"question\": \"Is Override the Answer?\", \"url\": \"put_override\" }}"

This doesn’t

curl ‘http://www.whatsayye.com/questions/3.json’ \

    -X "GET" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "X-HTTP-Method-Override: PUT" \

    -d "{ \"question\": { \"question\": \"Is Override the Answer?\", \"url\": \"put_override\" }}"

Any hints for me?

I’m using rails 2.3.3

AJ ONeal

I lied, the first one just doesn’t return an error, but it doesn’t work either.

AJ ONeal

I lied about lying; I was actually telling the truth. (it was expecting the json I was posting to be translated to an object params[:my_model_name] but actually it was put in params[:_json] [:my_model_name].

But I can't find where it is that I Rails determines whether to use the overridden method or the original method so that I can tell it to allow JSON as well.

It's actually not Rails code which does this anymore but a Rack middleware called Rack::MethodOverride which is part of Rack

http://rack.rubyforge.org/doc/classes/Rack/MethodOverride.html