ActiveRecord subselects - Today I Learned

Updated . Posted . Visible to the public.

Apparently you can pash a second scope to a hash-condition and the whole thing will be evaluated as a second SELECT statement with a subselect.

Note that sub-queries are extremely slow in MySQL, but they can make cases easier where performance does not matter so much (e.g. a migration on 50K records).

Henning Koch
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2016-07-17 11:07)