Permalink
Browse files

Fixed a case of convertion from symbol to string way before, causing …

…a hash

to lost keys like in the case of "a" and :a
  • Loading branch information...
1 parent 87d8efb commit 27c7f567b840f198c5425a7e1f823a52c09c1dce @mariochavez mariochavez committed Aug 7, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/addressable/uri.rb
View
@@ -1493,7 +1493,7 @@ def query_values=(new_query_values)
new_query_values = new_query_values.to_hash
new_query_values = flatten_keys new_query_values
new_query_values = new_query_values.map do |key, value|
- #key = key.to_s if key.kind_of?(Symbol)
+ key = key.to_s if key.kind_of?(Symbol)
[key, value]
end
# Useful default for OAuth and caching.
@@ -1529,13 +1529,12 @@ def query_values=(new_query_values)
def flatten_keys hash, keys=nil
new_hash = {}
hash.map do |k, v|
- string_key = k.to_s
- new_keys = keys ? "#{keys}[#{string_key}]" : string_key
+ new_keys = keys ? "#{keys}[#{k.to_s}]" : k
if v.is_a?(Hash)
sub_hash = flatten_keys v, new_keys
new_hash.merge! sub_hash
else
- new_hash.merge! k => v
+ new_hash.merge! new_keys => v
end
end
new_hash

0 comments on commit 27c7f56

Please sign in to comment.