aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
index 394daef473..fc4d84a4f2 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -314,13 +314,12 @@ module ActiveRecord
protected
def select(sql, name = nil, binds = []) #:nodoc:
- exec(sql, name, binds).map do |row|
- record = {}
- row.each do |key, value|
- record[key.sub(/^"?\w+"?\./, '')] = value
- end
- record
- end
+ result = exec(sql, name, binds)
+ columns = result.columns.map { |column|
+ column.sub(/^"?\w+"?\./, '')
+ }
+
+ result.rows.map { |row| Hash[columns.zip(row)] }
end
def table_structure(table_name)