Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
added ActiveRecord::Relation#left_outer_joins #12071
this adds the ability to use a
The ability to do this is already implemented in
User.outer_joins(:posts) => SELECT "users".* FROM "users" LEFT OUTER JOIN "posts" ON "posts"."user_id" = "users"."id"
Good point. If it's actually going to do an LOJ, the method should probably be
One thing I'd love to see but don't have a clear API for - the ability to specify additional bits in the
which would produce the SQL:
assuming there's a boolean
Note that the above is not equivalent to:
since that query doesn't include users who don't have any featured posts.
Without this feature, it would still be possible to create the desired SQL with a scoped association:
but that method doesn't exactly scale to arbitrary sets of conditions.
@al2o3cr +1. We should probably address that separately, afterwards, though... whatever we end up with seems like it should apply to