aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/CHANGELOG4
-rwxr-xr-xactiverecord/lib/active_record/associations.rb10
2 files changed, 12 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index ad7d0a668d..37d0ca53e4 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,6 +1,8 @@
*SVN*
-* Docs: warn that associations names shouldn't be reserved words. #4378 [murphy@cYcnus.de, Josh Susser]
+* Document deep eager includes. #6267 [Josh Susser, Dan Manges]
+
+* Document warning that associations names shouldn't be reserved words. #4378 [murphy@cYcnus.de, Josh Susser]
* Sanitize Base#inspect. #8392 [Nik Wakelin]
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.
#