diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-12 16:54:00 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-12 16:54:00 -0700 |
commit | 7c4e0401d25e29b2960ae2adb31194d908cfd25b (patch) | |
tree | 79a9cf250222587b623f9bbbe9cf7ed620fc451d /activerecord/lib | |
parent | cee2ff2768589cb81781fbbdafb9925ba203902f (diff) | |
download | rails-7c4e0401d25e29b2960ae2adb31194d908cfd25b.tar.gz rails-7c4e0401d25e29b2960ae2adb31194d908cfd25b.tar.bz2 rails-7c4e0401d25e29b2960ae2adb31194d908cfd25b.zip |
cleaning up PostgreSQLAdapter#select
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2fe2ae7136..004c6620df 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -941,15 +941,9 @@ module ActiveRecord # 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) |