How to use find in batches in Ruby on Rails along with pluck.
class NewYearJob
def perform
Employee.active.in_batches do |employees|
rotate_jobs = employees.pluck(:id).map do |employee_id|
RotateYearJob.new(employee_id)
end
ActiveJob.perform_all_later(rotate_jobs)
end
end
end
Top comments (0)