aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb4
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index e4103f1cb7..2334bb671b 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -173,7 +173,7 @@ module ActiveSupport #:nodoc:
# Turn { :files => { :file => #<StringIO> } into { :files => #<StringIO> } so it is compatible with
# how multipart uploaded files from HTML appear
- if xml_value && xml_value["file"].is_a?(StringIO)
+ if xml_value.is_a?(Hash) && xml_value["file"].is_a?(StringIO)
xml_value["file"]
else
xml_value
@@ -218,4 +218,4 @@ module ActiveSupport #:nodoc:
end
end
end
-end \ No newline at end of file
+end
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index ba121cc352..a428fe5061 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -572,6 +572,12 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal expected, hash.to_xml(@xml_options)
end
end
+
+ def test_empty_string_works_for_typecast_xml_value
+ assert_nothing_raised do
+ Hash.send(:typecast_xml_value, "")
+ end
+ end
end
class QueryTest < Test::Unit::TestCase