diff options
Diffstat (limited to 'actionpack/lib')
| -rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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) |
