Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disabling strict_loading when enabled by default #45018

Merged
merged 1 commit into from May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation.rb
Expand Up @@ -923,7 +923,7 @@ def exec_queries(&block)
preload_associations(records) unless skip_preloading_value

records.each(&:readonly!) if readonly_value
records.each(&:strict_loading!) if strict_loading_value
records.each { |record| record.strict_loading!(strict_loading_value) } unless strict_loading_value.nil?

records
end
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/cases/strict_loading_test.rb
Expand Up @@ -86,6 +86,7 @@ def test_strict_loading
def test_strict_loading_by_default
with_strict_loading_by_default(Developer) do
Developer.all.each { |d| assert d.strict_loading? }
Developer.strict_loading(false).each { |d| assert_not d.strict_loading? }
end
end

Expand Down