Module: Ohm::SoftDelete
- Defined in:
- lib/ohm/contrib/soft_delete.rb
Overview
Provides support for soft deletion
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- IS_DELETED =
"1"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
39 40 41 42 43 |
# File 'lib/ohm/contrib/soft_delete.rb', line 39 def self.included(base) base.attribute :deleted base.index :deleted base.extend ClassMethods end |
Instance Method Details
#delete ⇒ Object
45 46 47 |
# File 'lib/ohm/contrib/soft_delete.rb', line 45 def delete update(:deleted => IS_DELETED) end |
#deleted? ⇒ Boolean
49 50 51 |
# File 'lib/ohm/contrib/soft_delete.rb', line 49 def deleted? deleted == IS_DELETED end |