Sha256: 0f1f0308a0cf573a7cd543affe3cfe7a8a66dc479cd10d1a9360aa9f4bcc13b9

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

class BookDestroyAsync < ActiveRecord::Base
  self.table_name = "books"

  has_many :taggings, as: :taggable, class_name: "Tagging"
  has_many :tags, through: :taggings, dependent: :destroy_async
  has_many :essays, dependent: :destroy_async, class_name: "EssayDestroyAsync", foreign_key: "book_id"
  has_one :content, dependent: :destroy_async

  enum status: [:proposed, :written, :published]

  def published!
    super
    "do publish work..."
  end
end

class BookDestroyAsyncWithScopedTags < ActiveRecord::Base
  self.table_name = "books"

  has_many :taggings, as: :taggable, class_name: "Tagging"
  has_many :tags, -> { where name: "Der be rum" }, through: :taggings, dependent: :destroy_async
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/models/book_destroy_async.rb
ibm_db-5.4.1-x86-mingw32 test/models/book_destroy_async.rb
ibm_db-5.4.0-x86-mingw32 test/models/book_destroy_async.rb
ibm_db-5.3.2-x86-mingw32 test/models/book_destroy_async.rb