This project is archived and is in readonly mode.

#3683 ✓stale
Will Bryant

Add :preload option to find

Reported by Will Bryant | January 11th, 2010 @ 10:40 AM

This patch adds support for a :preload option, which functions much like the "new" :include path - but it will always use that rather than falling back to the old join-based :include path if the query options reference other tables.

Thus, it makes it possible to preload polymorphic associations even if you have some table conditions, other joins, or a multi-table :select option, and ensures you don't get O(n^m|m = number of loaded tables) resultsets in these conditions. It supports using both :include and :preload in one find, which is quite useful if you want to include to restrict the resultset but preload to efficiently load associations.

This should enable us to pass the bitter, cold evenings until 3.0 brings new association love.

Comments and changes to this ticket

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages