aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-05-19 19:08:16 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-05-19 19:08:16 +0000
commit7160ab1c18738ad357b68922b23ef47b204eef98 (patch)
tree3517425ba337d98a09426811e668a8f0af57368d /actionpack
parentc8b4cf65df48b7340dc8337cb23186c5e263bb2b (diff)
downloadrails-7160ab1c18738ad357b68922b23ef47b204eef98.tar.gz
rails-7160ab1c18738ad357b68922b23ef47b204eef98.tar.bz2
rails-7160ab1c18738ad357b68922b23ef47b204eef98.zip
Fixed escaping of :method option in remote_form_tag #1218 [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1328 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 90d69207e6..aca576feb7 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed escaping of :method option in remote_form_tag #1218 [Rick Olson]
+
* Added Serbia and Montenegro to the country_select #1239 [todd@robotcoop.com]
* Fixed Request#remote_ip in testing #1251 [bitsweat]
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index c897c5e8b8..11f513c01c 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -193,7 +193,7 @@ module ActionView
js_options = build_callbacks(options)
js_options['asynchronous'] = options[:type] != :synchronous
- js_options['method'] = options[:method] if options[:method]
+ js_options['method'] = method_option_to_s(options[:method]) if options[:method]
js_options['insertion'] = "Insertion.#{options[:position].to_s.camelize}" if options[:position]
if options[:form]
@@ -205,6 +205,10 @@ module ActionView
'{' + js_options.map {|k, v| "#{k}:#{v}"}.join(', ') + '}'
end
+ def method_option_to_s(method)
+ (method.is_a?(String) and !method.index("'").nil?) ? method : "'#{method}'"
+ end
+
def build_observer(klass, name, options = {})
options[:with] ||= 'value' if options[:update]
callback = remote_function(options)