Module: SoftDelete::Restorable

Extended by:
ActiveSupport::Concern
Defined in:
lib/soft_delete/restorable.rb

Instance Method Summary collapse

Instance Method Details

#restore_soft_delete(validate: true) ⇒ Object



11
12
13
14
15
# File 'lib/soft_delete/restorable.rb', line 11

def restore_soft_delete(validate: true)
  restore_soft_delete!(validate: validate)
rescue ActiveRecord::RecordInvalid
  false
end

#restore_soft_delete!(validate: true) ⇒ Object



17
18
19
20
# File 'lib/soft_delete/restorable.rb', line 17

def restore_soft_delete!(validate: true)
  self.deleted_at = nil
  save!(validate: validate)
end