Closed ellmetha closed 6 months ago
It appears it's not possible to use the in predicate to filter a many_to_one or one_to_one field from an array of records. For example, the following query set is not possible presently and results in a compilation error:
in
many_to_one
one_to_one
profiles = [Profiles::Profile.first!, Profiles::Profile.last!] Blogging::Article.filter(author__in: profiles)
Presently, the only way to write this query set would be to filter using an array of IDs:
profiles = [Profiles::Profile.first!, Profiles::Profile.last!] Blogging::Article.filter(author_id__in: profiles.map(&.pk))
Let's improve this by making it possible to filter relationship fields like many_to_one or one_to_one fields using an array of model records.
Description
It appears it's not possible to use the
in
predicate to filter amany_to_one
orone_to_one
field from an array of records. For example, the following query set is not possible presently and results in a compilation error:Presently, the only way to write this query set would be to filter using an array of IDs:
Let's improve this by making it possible to filter relationship fields like
many_to_one
orone_to_one
fields using an array of model records.