Merge pull request #51442 from rosa/skip-deprecation-warning-for-invalid-reflections
Emit deprecation warning about inverse_of inference only for valid reflections
This commit is contained in:
commit
d0ce794e2d
@ -760,7 +760,7 @@ def automatic_inverse_of
|
||||
plural_inverse_name = ActiveSupport::Inflector.pluralize(inverse_name)
|
||||
reflection = klass._reflect_on_association(plural_inverse_name)
|
||||
|
||||
if reflection && !active_record.automatically_invert_plural_associations
|
||||
if valid_inverse_reflection?(reflection) && !active_record.automatically_invert_plural_associations
|
||||
ActiveRecord.deprecator.warn(
|
||||
"The `#{active_record.name}##{name}` inverse association could have been automatically" \
|
||||
" inferred as `#{klass.name}##{plural_inverse_name}` but wasn't because `automatically_invert_plural_associations`" \
|
||||
|
Loading…
Reference in New Issue
Block a user