Module: GuardAgainstPhysicalDelete::Base::ClassMethods
- Defined in:
- lib/guard_against_physical_delete/base.rb
Instance Method Summary collapse
Instance Method Details
#delete_permitted? ⇒ Boolean
30 31 32 33 34 |
# File 'lib/guard_against_physical_delete/base.rb', line 30 def delete_permitted? return true unless [self.name].zero? return false if logical_delete? return true end |
#logical_delete? ⇒ Boolean
26 27 28 |
# File 'lib/guard_against_physical_delete/base.rb', line 26 def logical_delete? self.column_names.include? logical_delete_column.to_s end |
#physical_delete ⇒ Object
19 20 21 22 23 24 |
# File 'lib/guard_against_physical_delete/base.rb', line 19 def physical_delete [self.name] += 1 yield ensure [self.name] -= 1 end |