Module: Undestroyable::Orm::ActiveRecord::Database::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



52
53
54
55
56
57
58
59
# File 'lib/undestroyable/orm/active_record/database.rb', line 52

def destroy
  run_callbacks :destroy do
    deleted_attributes = undest_compile_insert_attributes
    deleted_attributes << [self.class.undest_arel_table['deleted_at'], Time.now.utc] if self.class.send(:undest_mirror).columns_hash['deleted_at']
    self.class.undest_relation.insert deleted_attributes
    destroy!
  end
end