This allows for the use of where(not)exists with a polymoprhic belongs_to on an empty relation.
We ran into the issue where parent.transactions.where_not_exists(:document)' basically resulted inSELECT * FROM transactions WHERE parent_id = 1234 AND (NOT ())`.
This fixes that case and a possible situation where, using the above example, no transactions have documents.
This allows for the use of where(not)exists with a polymoprhic belongs_to on an empty relation.
We ran into the issue where
parent.transactions.where_not_exists(:document)' basically resulted in
SELECT * FROM transactions WHERE parent_id = 1234 AND (NOT ())`.This fixes that case and a possible situation where, using the above example, no transactions have documents.