Skip to content

Commit ada130c

Browse files
authored
Merge pull request rails#46489 from OuYangJinTing/update-association-preload-doc [ci-skip]
Update association preload doc
2 parents db94278 + 229933d commit ada130c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

activerecord/lib/active_record/associations.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,10 @@ def association_instance_set(name, association)
586586
# has_many :birthday_events, ->(user) { where(starts_on: user.birthday) }, class_name: 'Event'
587587
# end
588588
#
589-
# Note: Joining, eager loading, and preloading of these associations is not possible.
590-
# These operations happen before instance creation and the scope will be called with a +nil+ argument.
589+
# Note: Joining and eager loading of these associations is not possible.
590+
# These two operations happen before instance creation and the scope will be called with a +nil+ argument.
591+
# It is allowed to be preloaded, but in the case that there's a different scope for each record,
592+
# this will perform N+1 queries. (this is essentially the same as preloading polymorphic scopes).
591593
#
592594
# == Association callbacks
593595
#

0 commit comments

Comments
 (0)