diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/conversions.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/conversions.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 35d010b164..2b42a55ab1 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -52,12 +52,20 @@ module ActiveSupport #:nodoc: options[:indent] ||= 2 options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent]) - root = options.delete(:root) + root = options.delete(:root).to_s children = options.delete(:children) + if !options.has_key?(:dasherize) || options[:dasherize] + root = root.dasherize + end + options[:builder].instruct! unless options.delete(:skip_instruct) - options[:builder].tag!(root.to_s.dasherize) { each { |e| e.to_xml(options.merge({ :skip_instruct => true, :root => children })) } } + + opts = options.merge({ :skip_instruct => true, :root => children }) + + options[:builder].tag!(root) { each { |e| e.to_xml(opts) } } end + end end end |