module DataMapper::Types::Paranoid::Base

Public Class Methods

included(model) click to toggle source
# File lib/dm-types/paranoid/base.rb, line 5
def self.included(model)
  model.extend ClassMethods
  model.instance_variable_set(:@paranoid_properties, {})
end

Public Instance Methods

paranoid_destroy() click to toggle source
# File lib/dm-types/paranoid/base.rb, line 10
def paranoid_destroy
  model.paranoid_properties.each do |name, block|
    attribute_set(name, block.call(self))
  end
  save_self
  self.persistence_state = Resource::PersistenceState::Immutable.new(self)
  true
end

Private Instance Methods

_destroy(execute_hooks = true) click to toggle source

@api private

Calls superclass method
# File lib/dm-types/paranoid/base.rb, line 22
def _destroy(execute_hooks = true)
  return false unless saved?
  if execute_hooks
    paranoid_destroy
  else
    super
  end
end