module WarpEngine::SoftDeletable
Model concern for soft deletion through a deleted_at column. Adds the scopes kept (not deleted) and discarded (deleted).
Public Instance Methods
Source
# File app/models/concerns/warp_engine/soft_deletable.rb, line 24 def discarded? deleted_at.present? end
Returns whether the record is soft-deleted.
Source
# File app/models/concerns/warp_engine/soft_deletable.rb, line 19 def restore! update_column(:deleted_at, nil) end
Clears deleted_at, without validations or callbacks.
Source
# File app/models/concerns/warp_engine/soft_deletable.rb, line 14 def soft_delete! update_column(:deleted_at, Time.current) end
Marks the record deleted by setting deleted_at to now, without validations or callbacks.