diff options
author | Ryan Wallace <rywall@gmail.com> | 2013-08-30 16:16:38 -0700 |
---|---|---|
committer | Ryan Wallace <rywall@gmail.com> | 2013-08-30 20:52:36 -0700 |
commit | 8467be9e142b0eb75b9007ca9510592ab11368b5 (patch) | |
tree | a1d4654625d4ac72315a99417c59e63877b2f2b2 /activerecord | |
parent | a3dd738c38df634a46a2261a0de27fd31de7ae51 (diff) | |
download | rails-8467be9e142b0eb75b9007ca9510592ab11368b5.tar.gz rails-8467be9e142b0eb75b9007ca9510592ab11368b5.tar.bz2 rails-8467be9e142b0eb75b9007ca9510592ab11368b5.zip |
Don't use Enumerable#next in pluck since it is very slow
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 52a538e5b5..27c04b0952 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -161,8 +161,7 @@ module ActiveRecord 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 |