Add ApplicationRecord.where_exists
What does this MR do?
This adds the method ApplicationRecord.where_exists
. In several places we use
the pattern .where('EXISTS (?)', ...)
, and this method allows us to cut down
the amount of duplication to implement this pattern.
This method was originally introduced as part of !44041 (merged), but I have extracted it to a separate MR so it can be reviewed and merged in isolation.