sample.rb
articles = Article
total_count = articles.count
per_batch = 2000
0.step(total_count, per_batch) do |offset|
articles.limit(per_batch).skip(offset).each.with_index(offset) do |article, i|
puts "#{i}/#{total_count}"
STDOUT.flush #nohup時に逐次表示させる
end
end