Active Record Query guide

I am marking this guide as done -
http://guides.rails.info/active_record_querying.html

So please go through it and report any vital missing items or any
suggestions! And in case you haven't contrubuted to the guides before
- http://guides.rails.info/contributing_to_rails.html#contributingtothe-rails-documentation
and http://guides.rails.info/contribute.html should help.

Patrick, I’m not sure if its a issue, but I mean it is:

In the section

4.1 Using a String SQL Fragment

You said to use manual join like this:

Client.all(:joins => 'LEFT OUTER JOIN addresses ON addresses.client_id = [client.id](http://client.id)')

And you said this block will give the following SQL block:

SELECT clients.* FROM clients INNER JOIN addresses ON addresses.client_id = [clients.id](http://clients.id)

In the Rails example you used LEFT OUTER JOIN, but in generated SQL you said that is an INNER JOIN

This is a doc issue or Rails really do this transformation?

Wilker Lúcio

Oops. That was wrong. Fixed it. Thanks for the report !

Hi, I found another minor mistake in same line:

In Rails code:

ON addresses.client_id = client.id

In SQL code:

ON addresses.client_id = clients.id

In Rails you said the table “client” and in SQL “clients”, I mean it’s to be “clients” in both

:slight_smile:

Wilker Lúcio

Fixed.

Thanks