method
foreign_key_present?
v4.1.8 -
Show latest stable
- Class:
ActiveRecord::Associations::Association
foreign_key_present?()private
Returns true if there is a foreign key present on the owner which references the target. This is used to determine whether we can load the target if the owner is currently a new record (and therefore without a key). If the owner is a new record then foreign_key must be present in order to load target.
Currently implemented by belongs_to (vanilla and polymorphic) and has_one/has_many :through associations which go through a belongs_to.