+ if (http_method === 'PATCH') {
+ // Some user agents do not support HTTP PATCH (notably,
+ // phantomjs silently ignores our "data" and sends an empty
+ // request body) so we use POST instead, and supply a
+ // _method=PATCH param to tell Rails what we really want.
+ data.push({name: '_method', value: http_method});
+ http_method = 'POST';
+ }