Module: Undestroyable::Orm::ActiveRecord::Dump::InstanceMethods

Defined in:
lib/undestroyable/orm/active_record/dump.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



70
71
72
73
74
75
76
77
# File 'lib/undestroyable/orm/active_record/dump.rb', line 70

def destroy
  run_callbacks :destroy do
    dump_attributes = {dump: Marshal::dump(self)}
    dump_attributes.merge!(deleted_at: Time.now.utc) if self.class.send(:undest_mirror).columns_hash['deleted_at']
    self.class.send(:undest_mirror).create(dump_attributes)
    destroy!
  end
end