Method: ActiveRecord::Associations::Association#stale_target?

Defined in:
lib/active_record/associations/association.rb

#stale_target?Boolean

The target is stale if the target no longer points to the record(s) that the relevant foreign_key(s) refers to. If stale, the association accessor method on the owner will reload the target. It’s up to subclasses to implement the stale_state method if relevant.

Note that if the target has not been loaded, it is not considered stale.

Returns:

  • (Boolean)


88
89
90
# File 'lib/active_record/associations/association.rb', line 88

def stale_target?
  loaded? && @stale_state != stale_state
end