module MongoMapper::SoftDeleted

Attributes

enabled[W]

Public Class Methods

enabled?() click to toggle source
# File lib/mongo_mapper/soft_deleted.rb, line 13
def enabled?
  instance_variable_defined?(:@enabled) ? @enabled : true
end
included(mod) click to toggle source
# 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