aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-13 17:53:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-26 13:44:09 -0700
commiteb83eb6c98ae95a994dcac07d2c6246f7fd61962 (patch)
tree34d76a4c019dd8557a831d13737a01ffe8040a7e /activerecord
parentfe2ee4fafdb6b29e4dde7ba287a4c342701e1056 (diff)
downloadrails-eb83eb6c98ae95a994dcac07d2c6246f7fd61962.tar.gz
rails-eb83eb6c98ae95a994dcac07d2c6246f7fd61962.tar.bz2
rails-eb83eb6c98ae95a994dcac07d2c6246f7fd61962.zip
monkey patching with enumerable so we can call each
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 76d5611cd2..04dbcff95c 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -17,17 +17,12 @@ class Mysql
class Time
###
# This monkey patch is for test_additional_columns_from_join_table
-
def to_date
Date.new(year, month, day)
end
end
-end
-
-class Mysql
- class Stmt
- include Enumerable
- end
+ class Stmt; include Enumerable end
+ class Result; include Enumerable end
end
module ActiveRecord
@@ -357,10 +352,9 @@ module ActiveRecord
log(sql, name) do
result = @connection.query(sql)
cols = result.fetch_fields.map { |field| field.name }
- values = []
- result.each { |row| values << row }
+ rows = result.to_a
result.free
- ActiveRecord::Result.new(cols, values)
+ ActiveRecord::Result.new(cols, rows)
end
end