aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-11-26 00:50:49 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-11-26 00:50:49 +0000
commite15b371777b72b6f2e71f27c5d55768083c87996 (patch)
tree6e2b12e913a68b6cd218485dfc8abe6e3e976ca1 /activerecord/lib/active_record
parent7022dd9c05064ef914f8836fb5e8b2d2ee3c02ed (diff)
downloadrails-e15b371777b72b6f2e71f27c5d55768083c87996.tar.gz
rails-e15b371777b72b6f2e71f27c5d55768083c87996.tar.bz2
rails-e15b371777b72b6f2e71f27c5d55768083c87996.zip
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
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 3d6290f50f..d3ba329406 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -85,7 +85,7 @@ module ActiveRecord
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 @@ module ActiveRecord
# 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