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)


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

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