aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-19 22:36:36 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-19 22:36:36 +0000
commit5b414190d034e18a3080b74a57a13039134f2834 (patch)
tree767e795d0aaef75d1dabb486fd86e1a83c014796 /activerecord/lib/active_record/associations.rb
parentc7c867ebd29f41c307e5246634c4625f9710a5ef (diff)
downloadrails-5b414190d034e18a3080b74a57a13039134f2834.tar.gz
rails-5b414190d034e18a3080b74a57a13039134f2834.tar.bz2
rails-5b414190d034e18a3080b74a57a13039134f2834.zip
Document deep eager includes. Closes #6267.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 85696505ab..b13c34d59c 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -422,7 +422,15 @@ module ActiveRecord
# for post in Post.find(:all, :include => [ :author, :comments ])
#
# That'll add another join along the lines of: LEFT OUTER JOIN comments ON comments.post_id = posts.id. And we'll be down to 1 query.
- # But that shouldn't fool you to think that you can pull out huge amounts of data with no performance penalty just because you've reduced
+ #
+ # To include a deep hierarchy of associations, using a hash:
+ #
+ # for post in Post.find(:all, :include => [ :author, { :comments => { :author => :gravatar } } ])
+ #
+ # That'll grab not only all the comments but all their authors and gravatar pictures. You can mix and match
+ # symbols, arrays and hashes in any combination to describe the associations you want to load.
+ #
+ # All of this power shouldn't fool you into thinking that you can pull out huge amounts of data with no performance penalty just because you've reduced
# the number of queries. The database still needs to send all the data to Active Record and it still needs to be processed. So it's no
# catch-all for performance problems, but it's a great way to cut down on the number of queries in a situation as the one described above.
#