Move account sensitize-related methods to concern (#28865)

This commit is contained in:
Matt Jankowski 2024-11-11 08:08:23 -05:00 committed by GitHub
parent d033920b7e
commit c78dc23b49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 13 deletions

View file

@ -0,0 +1,21 @@
# frozen_string_literal: true
module Account::Sensitizes
extend ActiveSupport::Concern
included do
scope :sensitized, -> { where.not(sensitized_at: nil) }
end
def sensitized?
sensitized_at.present?
end
def sensitize!(date = Time.now.utc)
update!(sensitized_at: date)
end
def unsensitize!
update!(sensitized_at: nil)
end
end