Skip to content

Commit

Permalink
Expanded :method option in FormTagHelper#form_tag, FormHelper#form_fo…
Browse files Browse the repository at this point in the history
…r, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed May 29, 2006
1 parent 2b58947 commit 8498c74
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions railties/html/javascripts/prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
var parameters = this.options.parameters || '';
if (parameters.length > 0) parameters += '&_=';

/* Simulate other verbs over post */
if (this.options.method != 'get' && this.options.method != 'post') {
parameters += (parameters.length > 0 ? '&' : '') + '_method=' + this.options.method
this.options.method = 'post'
}

try {
this.url = url;
if (this.options.method == 'get' && parameters.length > 0)
Expand Down

0 comments on commit 8498c74

Please sign in to comment.