Sha256: 72e41770aa4e89d6f653bff13ad823ab184fa9b393266e4bec9cb140fd6011dc

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

module PaperTrailAssociationTracking
  module VersionConcern
    extend ::ActiveSupport::Concern

    included do
      # Since the test suite has test coverage for this, we want to declare the association when the test suite is running.
      # This makes it pass when DB is not initialized prior to test runs such as when we run on Travis CI
      # Ex. (there won't be a db in `spec/dummy_app/db/`).
      if ::PaperTrail.config.track_associations?
        has_many :version_associations, dependent: :destroy
      end

      scope :within_transaction, ->(id) { where(transaction_id: id) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paper_trail-association_tracking-2.2.1 lib/paper_trail_association_tracking/version_concern.rb
paper_trail-association_tracking-2.2.0 lib/paper_trail_association_tracking/version_concern.rb