Created
April 22, 2015 22:14
-
-
Save egrueter-dev/544258ddd3cb8f8a4732 to your computer and use it in GitHub Desktop.
Eliminating N+1 Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@purchases = current_user.purchases.includes(:charges) | |
#loads the charges for a particular user's purchases into memory, when you | |
#call the below code, the application does not need to go back to memory... | |
current_user.purchases.charges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment