godaddy/spree — pull request #17 by BMorearty (2014-07-17 21:32:35+00:00)
Title: Improvements to API performance.

Refactor BaseController#product_scope to allow subclasses
to override the associations that are eager-loaded from a product.
In doing so, removed two associations that were eager-loaded
but never referenced (product.properties, variant.prices).

In Product#total_on_hand, don't load and instantiate all the
variants if all we need to know is whether any of them
track inventory. And don't load all the stock_items to sum their
counts on hand. (Fix to 368b89786).

Speeds up the API (e.g., /api/products, /api/products/1) by a factor of 8
for a product with 1,000 variants.