Skip to content

_method in recent rails is brokenish

by Topper on February 28th, 2010

I was trying to pass in _method: ‘put’ as part of a json body and for some reason rails kept not realizing that I wanted to put.

Then I came across this article:

So… if you’re using prototype your “put” methods look something like this:

new Ajax.Request(url, {
onSuccess: callback,
requestHeaders: {‘X-Http-Method-Override’: ‘put’},
postBody: Object.toJSON(params),
contentType: “application/json”