Module: SoftDelete
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/soft_delete.rb
Overview
typed: ignore frozen_string_literal: true
Instance Method Summary collapse
Instance Method Details
#soft_deleted? ⇒ Boolean
21 22 23 |
# File 'app/models/concerns/soft_delete.rb', line 21 def soft_deleted? deleted_at.present? end |
#soft_destroy ⇒ Object
14 15 16 17 18 19 |
# File 'app/models/concerns/soft_delete.rb', line 14 def soft_destroy run_callbacks :soft_destroy do # update both deleted_at and updated_at for cache consistency update(deleted_at: Time.zone.now, updated_at: Time.zone.now) end end |