Sha256: aeb91219e4cc7a3eb038e498985f1f1bfe275f5f7d4d4b847244c49fb20ed74b

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

class CompositeBook < ActiveRecord::Base
  self.primary_key = %i[id author_id]
  belongs_to :author
  if ENV['AR_VERSION'].to_f <= 7.0
    unless ENV["SKIP_COMPOSITE_PK"]
      has_many :composite_chapters, inverse_of: :composite_book,
                                    foreign_key: [:id, :author_id]
    end
  else
    has_many :composite_chapters, inverse_of: :composite_book,
                                  query_constraints: [:id, :author_id]
  end

  def self.sequence_name
    "composite_book_id_seq"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-import-1.8.1 test/models/composite_book.rb
activerecord-import-1.8.0 test/models/composite_book.rb