D For A Web Developer

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 11:35:39 PDT 2014


On 2014-05-01 15:54, "Marc Schütz" <schuetzm at gmx.net>" wrote:

> You can also use the built-in `includes()`, which does a LEFT OUTER JOIN:
>
>      Post.includes(:comments).where(comments: {title: "bar"})
>
> (It also eager-loads the comments, but this is usually desired anyway,
> because an OUTER JOIN doesn't make sense if you're not going to use the
> joined records.)

The SQL code "includes" generates is unspecified. Sometimes it can do an 
extra "select" instead of a "join".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list