aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/query_methods.rb
diff options
context:
space:
mode:
authorHenrik Hodne <me@henrikhodne.com>2013-07-17 11:10:35 -0700
committerHenrik Hodne <me@henrikhodne.com>2013-07-17 11:37:39 -0700
commitef350c9f2e35fc7e16c74158686c9ad2805cb465 (patch)
tree6a094dcb22e787c13183bc8d9c23574042b33880 /activerecord/lib/active_record/relation/query_methods.rb
parentfaf6f7851e7766bc64f9d8ed1ade0b5168c5b76f (diff)
downloadrails-ef350c9f2e35fc7e16c74158686c9ad2805cb465.tar.gz
rails-ef350c9f2e35fc7e16c74158686c9ad2805cb465.tar.bz2
rails-ef350c9f2e35fc7e16c74158686c9ad2805cb465.zip
Improve ActiveRecord::QueryMethods#includes docs
It's not immediately clear whether you can pass in multiple relations or not. After going through the code a bit, I saw that the arguments are just appended to an array. Also, added nested relations example. [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index fb585ab8ab..d0c56ac3d0 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -100,6 +100,14 @@ module ActiveRecord
# firing an additional query. This will often result in a
# performance improvement over a simple +join+.
#
+ # You can also specify multiple relationships, like this:
+ #
+ # users = User.includes(:address, :friends)
+ #
+ # Loading nested relationships is possible using a Hash:
+ #
+ # users = User.includes(:address, friends: [:address, :followers])
+ #
# === conditions
#
# If you want to add conditions to your included models you'll have