Created
June 23, 2011 06:16
-
-
Save anklos/1042006 to your computer and use it in GitHub Desktop.
DB Performance improvement -- N+1
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
#if a Person that has_many Friends | |
friends = Person.find(:all, :conditions => 'friend_conditions', :include => :address) | |
#it wont load sql query again to search address | |
@friend_addresses = person.friends.collect {|friend| friend.address.street} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment