mirror of https://github.com/rails/rails
Merge pull request #29611 from kamipo/add_test_case_for_unscoping_default_scope
Add a test case for unscoping `default_scope` in associations
This commit is contained in:
commit
f94b2e8503
|
@ -2354,8 +2354,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
car = Car.create!
|
||||
bulb = Bulb.create! name: "other", car: car
|
||||
|
||||
assert_equal bulb, Car.find(car.id).all_bulbs.first
|
||||
assert_equal bulb, Car.includes(:all_bulbs).find(car.id).all_bulbs.first
|
||||
assert_equal [bulb], Car.find(car.id).all_bulbs
|
||||
assert_equal [bulb], Car.includes(:all_bulbs).find(car.id).all_bulbs
|
||||
assert_equal [bulb], Car.eager_load(:all_bulbs).find(car.id).all_bulbs
|
||||
end
|
||||
|
||||
test "raises RecordNotDestroyed when replaced child can't be destroyed" do
|
||||
|
|
Loading…
Reference in New Issue