Sha256: c2fe08d3d238fe7d5d76946e919a25dd8ca389d20fe01dcc9194e8ef69454d12

Contents?: true

Size: 420 Bytes

Versions: 24

Compression:

Stored size: 420 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord::Associations
  module ForeignAssociation # :nodoc:
    def foreign_key_present?
      if reflection.klass.primary_key
        # CPK
        # owner.attribute_present?(reflection.active_record_primary_key)
        Array(reflection.active_record_primary_key).all? {|key| owner.attribute_present?(key)}
      else
        false
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
composite_primary_keys-11.0.3 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.0.2 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.0.1 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.0.0 lib/composite_primary_keys/associations/foreign_association.rb