Permalink
Browse files

Don't use Enumerable#next in pluck since it is very slow

  • Loading branch information...
1 parent a3dd738 commit 8467be9e142b0eb75b9007ca9510592ab11368b5 @rywall rywall committed Aug 30, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 activerecord/lib/active_record/relation/calculations.rb
@@ -161,8 +161,7 @@ def pluck(*column_names)
result = result.map do |attributes|
values = klass.initialize_attributes(attributes).values
- iter = columns.each
- values.map { |value| iter.next.type_cast value }
+ columns.zip(values).map { |column, value| column.type_cast value }
end
columns.one? ? result.map!(&:first) : result
end

0 comments on commit 8467be9

Please sign in to comment.