Skip to content
Browse files

use Hash#each to avoid a second hash lookup

  • Loading branch information...
1 parent 6b29dc8 commit 8fb838ed1690fb38ea3dfced1827ef5e7683cc3b @tenderlove tenderlove committed Jul 12, 2010
Showing with 2 additions and 4 deletions.
  1. +2 −4 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
View
6 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -283,10 +283,8 @@ def empty_insert_statement_value
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

0 comments on commit 8fb838e

Please sign in to comment.
Something went wrong with that request. Please try again.