Skip to content
Browse files

cleaning up PostgreSQLAdapter#select

  • Loading branch information...
1 parent cee2ff2 commit 7c4e0401d25e29b2960ae2adb31194d908cfd25b @tenderlove tenderlove committed Jul 12, 2010
Showing with 2 additions and 8 deletions.
  1. +2 −8 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
View
10 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -941,15 +941,9 @@ def last_insert_id(table, sequence_name) #:nodoc:
# conversions that are required to be performed here instead of in PostgreSQLColumn.
def select(sql, name = nil)
fields, rows = select_raw(sql, name)
- result = []
- for row in rows
- row_hash = {}
- fields.each_with_index do |f, i|
- row_hash[f] = row[i]
- end
- result << row_hash
+ rows.map do |row|
+ Hash[*fields.zip(row).flatten]
end
- result
end
def select_raw(sql, name = nil)

0 comments on commit 7c4e040

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