Skip to content

Relation subqueries #188

wants to merge 1 commit into from

2 participants

pfenig commented Feb 11, 2011

ActiveRecord::Relation where clauses hash syntax accepts an ActiveRecord::Relation as a value, but it maps the relation to ids when it could just use a subquery. By converting the Relation to an ast we can now accept any subquery.

Model.where(:id =>

will only run one query and it supports references to tables from the outer query.

Have corresponded with @tenderlove on this.

@pfenig pfenig removed an unnecessary second query when passing an ActiveRecord::Rel…
…ation to a where clause. And added ability to use subselects in where clauses.
Ruby on Rails member

Merged to master and pushed. Thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.