Module: MongoMapper::SoftDeleted
- Defined in:
- lib/mongo_mapper/soft_deleted.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Attribute Summary collapse
-
.enabled ⇒ Object
writeonly
Sets the attribute enabled.
Class Method Summary collapse
Class Attribute Details
.enabled=(value) ⇒ Object (writeonly)
Sets the attribute enabled
17 18 19 |
# File 'lib/mongo_mapper/soft_deleted.rb', line 17 def enabled=(value) @enabled = value end |
Class Method Details
.enabled? ⇒ Boolean
13 14 15 |
# File 'lib/mongo_mapper/soft_deleted.rb', line 13 def enabled? instance_variable_defined?(:@enabled) ? @enabled : true end |
.included(mod) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mongo_mapper/soft_deleted.rb', line 20 def self.included(mod) mod.extend(MongoMapper::SoftDeleted::ClassMethods) mod.send(:include, MongoMapper::SoftDeleted::InstanceMethods) mod.after_destroy do return true unless MongoMapper::SoftDeleted.enabled? soft_delete_destroy(self) true end end |