From 1f75319a9af595d5de3dca55e26547c7f1b166fa Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 1 Jul 2013 18:06:25 -0700 Subject: avoid intermediate zipped array --- activerecord/lib/active_record/relation/calculations.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index fe1480d8c2..477da618df 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -161,9 +161,8 @@ module ActiveRecord result = result.map do |attributes| values = klass.initialize_attributes(attributes).values - columns.zip(values).map do |column, value| - column.type_cast(value) - end + iter = columns.each + values.map { |value| iter.next.type_cast value } end columns.one? ? result.map!(&:first) : result end -- cgit v1.2.3