Skip to content

Commit

Permalink
Merge pull request #45018 from lucthev/lt/strict-false
Browse files Browse the repository at this point in the history
Fix disabling strict_loading when enabled by default
  • Loading branch information
eileencodes committed May 4, 2022
1 parent fd7dc8f commit f99f422
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation.rb
Expand Up @@ -917,7 +917,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

0 comments on commit f99f422

Please sign in to comment.