method
can_find_inverse_of_automatically?
v6.1.3.1 -
Show latest stable
- Class:
ActiveRecord::Reflection::AssociationReflection
can_find_inverse_of_automatically?(reflection)private
Checks to see if the reflection doesn’t have any options that prevent us from being able to guess the inverse automatically. First, the inverse_of option cannot be set to false. Second, we must have has_many, has_one, belongs_to associations. Third, we must not have options such as :foreign_key which prevent us from correctly guessing the inverse association.
Anything with a scope can additionally ruin our attempt at finding an inverse, so we exclude reflections with scopes.