Fix association with scope including joins
#29413

kamipo wants to merge kamipo:fix_association_with_scope_including_joins into rails:master

We do not currently have an analysis of these two commits