diff options
author | Oscar Del Ben <oscar@oscardelben.com> | 2012-07-05 18:43:48 -0700 |
---|---|---|
committer | Oscar Del Ben <oscar@oscardelben.com> | 2012-07-05 18:43:48 -0700 |
commit | d203a0e0b4f2a1959fb3dc486a5ee6684b44ccb3 (patch) | |
tree | da2dce047bebe5d22d5c3d4562eaab939fa5fa4e /activerecord/lib/active_record | |
parent | aa43fa9a0389c65c64ff2b458920abdd61e29ef6 (diff) | |
download | rails-d203a0e0b4f2a1959fb3dc486a5ee6684b44ccb3.tar.gz rails-d203a0e0b4f2a1959fb3dc486a5ee6684b44ccb3.tar.bz2 rails-d203a0e0b4f2a1959fb3dc486a5ee6684b44ccb3.zip |
Add documentation for includes
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 6f49548aab..51d21121c8 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -41,6 +41,17 @@ module ActiveRecord alias extensions extending_values + # Specify relationships to be included in the result set. For + # example: + # + # users = User.includes(:address) + # users.each do |user| + # user.address.city + # end + # + # allows you to access the +address+ attribute of the +User+ model without + # firing an additional query. This will often result in a + # performance improvement over a simple +join+ def includes(*args) args.empty? ? self : spawn.includes!(*args) end |