1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/associations
Ryuta Kamizono 17f2f3054c Association loading isn't to be affected by scoping consistently
Follow-up of 5c71000, #29834, and #30271.

Currently, preloading and eager loading are not to be affected by
scoping, with the exception of `unscoped`.

But non eager loaded association access is still affected by scoping.

Although this is a breaking change, the association loading will work
consistently whether preloaded / eager loaded or not.

Before:

```ruby
Post.where("1=0").scoping do
  Comment.find(1).post                   # => nil
  Comment.preload(:post).find(1).post    # => #<Post id: 1, ...>
  Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...>
end
```

After:

```ruby
Post.where("1=0").scoping do
  Comment.find(1).post                   # => #<Post id: 1, ...>
  Comment.preload(:post).find(1).post    # => #<Post id: 1, ...>
  Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...>
end
```

Fixes #34638.
Fixes #35398.
2019-04-05 13:21:50 +09:00
..
belongs_to_associations_test.rb Fix pluck and select with custom attributes 2019-02-13 02:47:46 +09:00
bidirectional_destroy_dependencies_test.rb
callbacks_test.rb Use assert_empty and assert_not_empty 2018-01-25 23:32:59 -05:00
cascaded_eager_loading_test.rb Use assert_queries(0) instead of assert_no_queries to ignore metadata queries 2019-03-26 02:51:03 +00:00
eager_load_includes_full_sti_class_test.rb Fix CI failure due to remaining tagging records 2019-03-26 12:59:16 +09:00
eager_load_nested_include_test.rb Use assert_no_queries not to ignore BEGIN/COMMIT queries 2018-10-05 04:11:13 +09:00
eager_singularization_test.rb
eager_test.rb Association loading isn't to be affected by scoping consistently 2019-04-05 13:21:50 +09:00
extension_test.rb Change the empty block style to have space inside of the block 2018-09-25 13:19:35 -04:00
has_and_belongs_to_many_associations_test.rb Enable Style/RedundantBegin cop to avoid newly adding redundant begin block 2018-12-21 06:12:42 +09:00
has_many_associations_test.rb Merge pull request #35247 from bogdan/fix-source-reflection-reset-code 2019-02-20 21:24:38 +09:00
has_many_through_associations_test.rb Fix callbacks on has_many :through associations (#33249) 2019-03-30 00:37:08 -04:00
has_one_associations_test.rb Address test_belongs_to_does_not_use_order_by failure due to checking order by for metadata queries 2019-02-08 00:33:16 +00:00
has_one_through_associations_test.rb More exercise singular association query 2018-11-28 03:34:20 +09:00
inner_join_association_test.rb Stash left_joins into joins to deduplicate redundant LEFT JOIN 2019-04-05 06:40:53 +09:00
inverse_associations_test.rb Revert "Merge pull request #33729 from kddeisz/plural-automatic-inverse" 2019-02-01 01:34:49 +09:00
join_model_test.rb Replace assert ! with assert_not 2018-04-19 08:11:33 -04:00
left_outer_join_association_test.rb Stash left_joins into joins to deduplicate redundant LEFT JOIN 2019-04-05 06:40:53 +09:00
nested_through_associations_test.rb Fix preloader to never reset associations in case they are already loaded 2019-03-07 16:48:46 +02:00
required_test.rb Enable Style/RedundantBegin cop to avoid newly adding redundant begin block 2018-12-21 06:12:42 +09:00