Permalink
Browse files

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
  • Loading branch information...
dhh committed Nov 26, 2004
1 parent 7022dd9 commit e15b371777b72b6f2e71f27c5d55768083c87996
Showing with 4 additions and 6 deletions.
  1. +4 −6 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -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

0 comments on commit e15b371

Please sign in to comment.