Sha256: 8909e4a3e459fb8bea6e2d1dba621f7e8777dbd724f1b536158327f6d2a64160

Contents?: true

Size: 453 Bytes

Versions: 5

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literal: true

class DestroyAsyncParentSoftDelete < ActiveRecord::Base
  has_many :taggings, as: :taggable, class_name: "Tagging"
  has_many :tags, through: :taggings,
    dependent: :destroy_async,
    ensuring_owner_was: :deleted?

  has_one :dl_keyed_has_one, dependent: :destroy_async,
    ensuring_owner_was: :deleted?

  def deleted?
    deleted
  end

  def destroy
    update(deleted: true)
    run_callbacks(:destroy)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/models/destroy_async_parent_soft_delete.rb
ibm_db-5.4.1 test/models/destroy_async_parent_soft_delete.rb
ibm_db-5.4.0 test/models/destroy_async_parent_soft_delete.rb
ibm_db-5.3.2 test/models/destroy_async_parent_soft_delete.rb
ibm_db-5.3.1 test/models/destroy_async_parent_soft_delete.rb