On 2014-05-01 15:54, "Marc Schütz" <schue...@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

Reply via email to