Module: Cms::Behaviors::SoftDeleting::InstanceMethods
- Defined in:
- lib/cms/behaviors/soft_deleting.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroying a soft deletable model should mark the record as deleted, and not actually remove it from the database.
- #destroy! ⇒ Object
- #destroyed? ⇒ Boolean
- #mark_as_deleted! ⇒ Object
Instance Method Details
#destroy ⇒ Object
Destroying a soft deletable model should mark the record as deleted, and not actually remove it from the database.
Overrides original destroy method
81 82 83 84 85 86 87 88 89 |
# File 'lib/cms/behaviors/soft_deleting.rb', line 81 def destroy run_callbacks :destroy do if self.class.publishable? update_attributes(:deleted => true, :publish_on_save => true) else update_attributes(:deleted => true) end end end |
#destroy! ⇒ Object
95 96 97 |
# File 'lib/cms/behaviors/soft_deleting.rb', line 95 def destroy! transaction { super.destroy } end |
#destroyed? ⇒ Boolean
99 100 101 |
# File 'lib/cms/behaviors/soft_deleting.rb', line 99 def destroyed? @destroyed end |
#mark_as_deleted! ⇒ Object
91 92 93 |
# File 'lib/cms/behaviors/soft_deleting.rb', line 91 def mark_as_deleted! destroy end |