3 ms·
The #map and #select approach in your example is even worse since it loads all of the associated friend and photo records into memory and tries to use Ruby for
by carbon8 16y ago
The #map and #select approach in your example is even worse since it loads all of the associated friend and photo records into memory and tries to use Ruby for queries that should be performed by the database. If there are more than a handful of those records, that process will balloon up and could bring the server to a halt.