rails/rails — pull request #9503 by wangjohn (2013-03-01 06:30:35+00:00)
Title: Find() in associations now checks in-memory records before going to the database

This fixes issuehttps://github.com/rails/rails/issues/9470. The ```find()``` method on an association will now first check to see if any records exist in the association with the given ids before visiting the database. This prevents an unneeded database call if the records already exist in memory.

The new function scans the target of the association for the ids sent as inputs to ```find()```. The ids of the records that are found are removed from the ids which will be sent to the database.