This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: | |
# 1. https://gist.github.com/siannopollo/03d646eb7525f7fce678#file-pluck_in_batches-rb | |
# 2. https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/batches.rb | |
class ActiveRecord::Relation | |
# pluck_in_batches: yields an array of *columns that is at least size | |
# batch_size to a block. | |
# | |
# Special case: if there is only one column selected than each batch | |
# will yield an array of columns like [:column, :column, ...] |