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-13.0.1 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-13.0.0 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.10 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.9 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.8 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.6 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.5 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.4 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.3 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.2 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.3.1 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.1 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0.rc5 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0.rc4 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0.rc3 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0.rc2 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-12.0.0.rc1 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.2.0 lib/composite_primary_keys/associations/foreign_association.rb
composite_primary_keys-11.1.0 lib/composite_primary_keys/associations/foreign_association.rb