Module: ActiveRecord::Associations::ForeignAssociation

Included in:
HasManyAssociation, HasOneAssociation
Defined in:
lib/active_record/associations/foreign_association.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#foreign_key_present?Boolean

Returns:

  • (Boolean)

5
6
7
8
9
10
11
# File 'lib/active_record/associations/foreign_association.rb', line 5

def foreign_key_present?
  if reflection.klass.primary_key
    owner.attribute_present?(reflection.active_record_primary_key)
  else
    false
  end
end