Support foreign associations querying, e.g. `Parent.where(children: Child.first)` or `Parent.where(children: [])`

Hello, I have a desire to play around ActiveRecord::PredicateBuilder so it would unfold the foreign associations queries using nested queries, like this:

  • Parent.where(children: Child.first) -> Parent.where(id: Child.first.parent_id)

  • Parent.where(children: Child.where(id: 1)) -> Parent.where(id: Child.where(id: 1).select(:parent_id))

  • Parent.where(children: []) -> Parent.where.not(id: Child.select(:parent_id))

Is there any chance this feature could be accepted and supported?