Module: GuardAgainstPhysicalDelete::Base::InstanceMethods

Defined in:
lib/guard_against_physical_delete/base.rb

Instance Method Summary collapse

Instance Method Details

#_delete_rowObject



48
49
50
51
52
53
54
# File 'lib/guard_against_physical_delete/base.rb', line 48

def _delete_row
  unless self.class.delete_permitted?
    raise ::GuardAgainstPhysicalDelete::PhysicalDeleteError, self.class.name
  end

  super
end

#hard_deleteObject



57
58
59
# File 'lib/guard_against_physical_delete/base.rb', line 57

def hard_delete
  self.class.physical_delete { destroy }
end

#soft_deleteObject



61
62
63
64
# File 'lib/guard_against_physical_delete/base.rb', line 61

def soft_delete
  self.__send__(:"#{self.class.logical_delete_column}=", Time.now)
  self.save!
end