Skip to content

Instantly share code, notes, and snippets.

@tom-lord
Created October 12, 2018 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tom-lord/2d63f1236c467b71cbf43cd66bed3e3a to your computer and use it in GitHub Desktop.
Save tom-lord/2d63f1236c467b71cbf43cd66bed3e3a to your computer and use it in GitHub Desktop.
class LeaseDeal < ApplicationRecord
def self.expire_all(time: Time.current, batch_size: 1000)
in_batches(of: batch_size).update_all(expired_at: time)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment