aboutsummaryrefslogtreecommitdiffstats
path: root/railties/html/javascripts
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-05-29 00:05:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-05-29 00:05:41 +0000
commit8498c74a99d4db42060dcf4be1d8270c755a5bdc (patch)
treef15157e46c0ea9ab2bfb6021bda17785f5ed5605 /railties/html/javascripts
parent2b5894741bdbc4b7e8ba7764eabbcfe33123dbfc (diff)
downloadrails-8498c74a99d4db42060dcf4be1d8270c755a5bdc.tar.gz
rails-8498c74a99d4db42060dcf4be1d8270c755a5bdc.tar.bz2
rails-8498c74a99d4db42060dcf4be1d8270c755a5bdc.zip
Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, 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
Diffstat (limited to 'railties/html/javascripts')
-rw-r--r--railties/html/javascripts/prototype.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/html/javascripts/prototype.js b/railties/html/javascripts/prototype.js
index 0caf9cd7f0..5ba3a30218 100644
--- a/railties/html/javascripts/prototype.js
+++ b/railties/html/javascripts/prototype.js
@@ -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)