Skip to content
Browse files

Fixed the to_xml case (closes #4201) [twoggle@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3925 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 9d7de52 commit 8b8a30dd0a58325fe64a9dcd86adc2e7104f1edf @dhh dhh committed
Showing with 4 additions and 6 deletions.
  1. +4 −6 activesupport/lib/active_support/core_ext/hash/conversions.rb
View
10 activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -21,13 +21,11 @@ def to_xml(options = {})
options[:builder].instruct! unless options.delete(:skip_instruct)
options[:builder].__send__(options[:root].to_s.dasherize) do
- for key in keys
- value = self[key]
-
- case value.class.to_s # TODO: Figure out why I have to to_s the class to do comparisons in order for tests to run
- when "Hash"
+ each do |key, value|
+ case value
+ when ::Hash
value.to_xml(options.merge({ :root => key, :skip_instruct => true }))
- when "Array"
+ when ::Array
value.to_xml(options.merge({ :root => key, :children => key.to_s.singularize, :skip_instruct => true}))
else
type_name = XML_TYPE_NAMES[value.class.to_s]

0 comments on commit 8b8a30d

Please sign in to comment.
Something went wrong with that request. Please try again.