aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-18 15:28:46 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-18 15:28:46 +0000
commit8b8a30dd0a58325fe64a9dcd86adc2e7104f1edf (patch)
tree6c8d7cb3de8570f2bbce4f06bb39c21d343d49a3 /activesupport
parent9d7de52c2d0ff73e5b9f3bc942db3ada64abe28b (diff)
downloadrails-8b8a30dd0a58325fe64a9dcd86adc2e7104f1edf.tar.gz
rails-8b8a30dd0a58325fe64a9dcd86adc2e7104f1edf.tar.bz2
rails-8b8a30dd0a58325fe64a9dcd86adc2e7104f1edf.zip
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
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index 31779e6b20..d556bab09b 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -21,13 +21,11 @@ module ActiveSupport #:nodoc:
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]