提交 795c71f2 编写于 作者: J Jamis Buck

dasherize the root element when doing to_xml


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3901 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 17e1f7b3
......@@ -38,7 +38,7 @@ def to_xml(options = {})
children = options.delete(:children)
options[:builder].instruct! unless options.delete(:skip_instruct)
options[:builder].tag!(root) { each { |e| e.to_xml(options.merge({ :skip_instruct => true, :root => children })) } }
options[:builder].tag!(root.to_s.dasherize) { each { |e| e.to_xml(options.merge({ :skip_instruct => true, :root => children })) } }
end
end
end
......
......@@ -20,7 +20,7 @@ def to_xml(options = {})
options.reverse_merge!({ :builder => Builder::XmlMarkup.new(:indent => options[:indent]), :root => "hash" })
options[:builder].instruct! unless options.delete(:skip_instruct)
options[:builder].__send__(options[:root]) do
options[:builder].__send__(options[:root].to_s.dasherize) do
for key in keys
value = self[key]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册