Merge pull request #45018 from lucthev/lt/strict-false

Fix disabling strict_loading when enabled by default
This commit is contained in:
Eileen M. Uchitelle 2022-05-04 14:09:41 -04:00 committed by GitHub
commit df1e1bc35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -923,7 +923,7 @@ module ActiveRecord
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

View File

@ -86,6 +86,7 @@ class StrictLoadingTest < ActiveRecord::TestCase
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