Posted 11 days ago. Visible to the public. Linked content.
Strict Loading Associations can prevent n+1 queries
Rails 6.1 has amode that forces the developer to preload any association they plan to use. Associations no longer load lazily. An error is raised when reading an association that was not preloaded.
Enabling strict loading is a tool to prevent.
Strict loading can be enabled for individual records, for a single association, for an entire model, or globally for all models.
See thefor details.