Skip to content

Commit

Permalink
Merge pull request #14139 from anilmaurya/master
Browse files Browse the repository at this point in the history
[ci skip] updating active_record/associations to demonstrate where conflict with eager loading.
  • Loading branch information
senny committed Apr 29, 2014
1 parent 099efc0 commit 4841ad3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -773,6 +773,12 @@ def association_instance_set(name, association)
# like this can have unintended consequences.
# 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.
#
# 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.
#
Expand Down

0 comments on commit 4841ad3

Please sign in to comment.