提交 e15b3717 编写于 作者: D David Heinemeier Hansson

symbolize_strings_in_hash shouldnt change receiver -- this should fix the bug...

symbolize_strings_in_hash shouldnt change receiver -- this should fix the bug with dump_schema in the rakefile

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@17 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 7022dd9c
......@@ -85,7 +85,7 @@ def self.establish_connection(spec = nil)
when Symbol, String
establish_connection(configurations[spec.to_s])
else
symbolize_strings_in_hash(spec)
spec = symbolize_strings_in_hash(spec)
unless spec.key?(:adapter) then raise AdapterNotSpecified end
adapter_method = "#{spec[:adapter]}_connection"
......@@ -149,11 +149,9 @@ def self.connection=(spec)
# Converts all strings in a hash to symbols.
def self.symbolize_strings_in_hash(hash)
hash.each do |key, value|
if key.class == String
hash.delete key
hash[key.intern] = value
end
hash.inject({}) do |hash_with_symbolized_strings, pair|
hash_with_symbolized_strings[pair.first.to_sym] = pair.last
hash_with_symbolized_strings
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册