There were a problem with through association with STI #14046
The problem was caused by Foo.unscoped. If model Foo was create via STI Foo.unscoped.valuse[:where] returns where condition to handle the STI logic.
But on through association on the first place we don't want to put this were clause to join table. I simply added check for reflection.scope. And if it is blank than simply skip this.
Fixed problem with through association with STI. #14046