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
上级 c8b4cf65
*SVN* *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] * Added Serbia and Montenegro to the country_select #1239 [todd@robotcoop.com]
* Fixed Request#remote_ip in testing #1251 [bitsweat] * Fixed Request#remote_ip in testing #1251 [bitsweat]
......
...@@ -193,7 +193,7 @@ def options_for_ajax(options) ...@@ -193,7 +193,7 @@ def options_for_ajax(options)
js_options = build_callbacks(options) js_options = build_callbacks(options)
js_options['asynchronous'] = options[:type] != :synchronous 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] js_options['insertion'] = "Insertion.#{options[:position].to_s.camelize}" if options[:position]
if options[:form] if options[:form]
...@@ -205,6 +205,10 @@ def options_for_ajax(options) ...@@ -205,6 +205,10 @@ def options_for_ajax(options)
'{' + js_options.map {|k, v| "#{k}:#{v}"}.join(', ') + '}' '{' + js_options.map {|k, v| "#{k}:#{v}"}.join(', ') + '}'
end end
def method_option_to_s(method)
(method.is_a?(String) and !method.index("'").nil?) ? method : "'#{method}'"
end
def build_observer(klass, name, options = {}) def build_observer(klass, name, options = {})
options[:with] ||= 'value' if options[:update] options[:with] ||= 'value' if options[:update]
callback = remote_function(options) callback = remote_function(options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册