diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-12 16:32:08 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-12 16:32:45 -0700 |
commit | 8fb838ed1690fb38ea3dfced1827ef5e7683cc3b (patch) | |
tree | 8f42fa15b65b997a47bd582d5944dc1c48d27c22 /activerecord/lib/active_record | |
parent | 6b29dc876fe185881d46731c3ae170478a3828fe (diff) | |
download | rails-8fb838ed1690fb38ea3dfced1827ef5e7683cc3b.tar.gz rails-8fb838ed1690fb38ea3dfced1827ef5e7683cc3b.tar.bz2 rails-8fb838ed1690fb38ea3dfced1827ef5e7683cc3b.zip |
use Hash#each to avoid a second hash lookup
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index b7f730d06a..7ccd50bd8c 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -283,10 +283,8 @@ module ActiveRecord def select(sql, name = nil) #:nodoc: execute(sql, name).map do |row| record = {} - row.each_key do |key| - if key.is_a?(String) - record[key.sub(/^"?\w+"?\./, '')] = row[key] - end + row.each do |key, value| + record[key.sub(/^"?\w+"?\./, '')] = value if key.is_a?(String) end record end |