Created
October 12, 2018 14:36
-
-
Save tom-lord/456dc3b98804813361eddcf095701540 to your computer and use it in GitHub Desktop.
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
class LeaseDeal < ApplicationRecord | |
def self.expire_all(time: Time.current, batch_size: 1000) | |
ids = pluck(:id) | |
ids.each_slice(batch_size) do |ids_slice| | |
unscoped.where(id: ids_slice).update_all(expired_at: time) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment