Move account sensitize-related methods to concern (#28865)
This commit is contained in:
parent
d033920b7e
commit
c78dc23b49
3 changed files with 40 additions and 13 deletions
21
app/models/concerns/account/sensitizes.rb
Normal file
21
app/models/concerns/account/sensitizes.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue