diff options
author | Maxime Lapointe <hunter_spawn@hotmail.com> | 2016-08-17 11:16:36 -0400 |
---|---|---|
committer | Maxime Lapointe <hunter_spawn@hotmail.com> | 2017-06-20 20:47:22 -0400 |
commit | 249ddd0c39e6f24145ae1150d4c8eec9f11219b1 (patch) | |
tree | 841ff60580940f95da883d97c127bc9d5f6d0e92 /activerecord/lib/active_record/version.rb | |
parent | 0787727cd65d820df78c9cd71ac9f145c9834762 (diff) | |
download | rails-249ddd0c39e6f24145ae1150d4c8eec9f11219b1.tar.gz rails-249ddd0c39e6f24145ae1150d4c8eec9f11219b1.tar.bz2 rails-249ddd0c39e6f24145ae1150d4c8eec9f11219b1.zip |
Keep INNER JOIN when merging relations
Doing `Author.joins(:posts).merge(Post.joins(:comments))` does this
`SELECT ... INNER JOIN posts ON... LEFT OUTER JOIN comments ON...`
instead of doing
`SELECT ... INNER JOIN posts ON... INNER JOIN comments ON...`.
This behavior is unexpected and makes little sense as, basically, doing
`Post.joins(:comments)` means I want posts that have comments. Turning
it to a LEFT JOIN means I want posts and join the comments data, if
any.
We can see this problem directly in the existing tests.
The test_relation_merging_with_merged_joins_as_symbols only does joins
from posts to comments to ratings while the ratings fixture isn't
loaded, but the count is non-zero.
Diffstat (limited to 'activerecord/lib/active_record/version.rb')
0 files changed, 0 insertions, 0 deletions