Skip to content

Commit d0ce794

Browse files
authored
Merge pull request rails#51442 from rosa/skip-deprecation-warning-for-invalid-reflections
Emit deprecation warning about inverse_of inference only for valid reflections
2 parents 59eb4f4 + 6758b86 commit d0ce794

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/reflection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def automatic_inverse_of
760760
plural_inverse_name = ActiveSupport::Inflector.pluralize(inverse_name)
761761
reflection = klass._reflect_on_association(plural_inverse_name)
762762

763-
if reflection && !active_record.automatically_invert_plural_associations
763+
if valid_inverse_reflection?(reflection) && !active_record.automatically_invert_plural_associations
764764
ActiveRecord.deprecator.warn(
765765
"The `#{active_record.name}##{name}` inverse association could have been automatically" \
766766
" inferred as `#{klass.name}##{plural_inverse_name}` but wasn't because `automatically_invert_plural_associations`" \

0 commit comments

Comments
 (0)