Skip to content

Commit

Permalink
docs, restructure newly added part to includes. [ci skip]
Browse files Browse the repository at this point in the history
This is a follow up to #14139.

/cc @carlosantoniodasilva
  • Loading branch information
senny committed May 3, 2014
1 parent 022c797 commit 5757fe4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -774,16 +774,15 @@ def association_instance_set(name, association)
# In the above example posts with no approved comments are not returned at all, because
# the conditions apply to the SQL statement as a whole and not just to the association.
#
# You must disambiguate column references for this fallback to happen, for example
# <tt>order: "author.name DESC"</tt> will work but <tt>order: "name DESC"</tt> will not.
#
# If you want to load all posts (including posts with no approved comments) then write
# your own LEFT OUTER JOIN query using ON
#
# Post.joins('LEFT OUTER JOIN comments ON comments.post_id = posts.id AND comments.approved = true')
#
# You must disambiguate column references for this fallback to happen, for example
# <tt>order: "author.name DESC"</tt> will work but <tt>order: "name DESC"</tt> will not.
# Post.joins("LEFT OUTER JOIN comments ON comments.post_id = posts.id AND comments.approved = '1'")
#
# If you do want eager load only some members of an association it is usually more natural
# to include an association which has conditions defined on it:
# In this case it is usually more natural to include an association which has conditions defined on it:
#
# class Post < ActiveRecord::Base
# has_many :approved_comments, -> { where approved: true }, class_name: 'Comment'
Expand Down

0 comments on commit 5757fe4

Please sign in to comment.