Skip to content

Commit 8a2fd9c

Browse files
docs: document when error raising is skipped for strict loading
Strict loading error raising is skipped during validation, but this behavior was undocumented. This commit adds a note clarifying that validation contexts do not trigger strict loading violations, to help prevent confusion. Fixes: rails#55128
1 parent 81d64b1 commit 8a2fd9c

File tree

1 file changed

+2
-0
lines changed
  • activerecord/lib/active_record

1 file changed

+2
-0
lines changed

activerecord/lib/active_record/core.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ def strict_loading?
690690
# Sets the record to strict_loading mode. This will raise an error
691691
# if the record tries to lazily load an association.
692692
#
693+
# NOTE: Strict loading is disabled during validation in order to let the record validate its association.
694+
#
693695
# user = User.first
694696
# user.strict_loading! # => true
695697
# user.address.city

0 commit comments

Comments
 (0)