Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Relation subqueries #188
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 => AnotherModel.some_scope.select(:some_id))
will only run one query and it supports references to tables from the outer query.
Have corresponded with @tenderlove on this.