Skip to content

Commit

Permalink
Added cascading eager loading that allows for queries like Author.fin…
Browse files Browse the repository at this point in the history
…d(:all, :include=> { :posts=> :comments }), which will fetch all authors, their posts, and the comments belonging to those posts in a single query (using LEFT OUTER JOIN) #3913 [anna@wota.jp]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3769 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 4, 2006
1 parent 30caefd commit 55854c4
Show file tree
Hide file tree
Showing 4 changed files with 349 additions and 138 deletions.
29 changes: 29 additions & 0 deletions activerecord/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
*SVN*

* Added cascading eager loading that allows for queries like Author.find(:all, :include=> { :posts=> :comments }), which will fetch all authors, their posts, and the comments belonging to those posts in a single query (using LEFT OUTER JOIN) #3913 [anna@wota.jp]. Examples:

# cascaded in two levels
>> Author.find(:all, :include=>{:posts=>:comments})
=> authors
+- posts
+- comments

# cascaded in two levels and normal association
>> Author.find(:all, :include=>[{:posts=>:comments}, :categorizations])
=> authors
+- posts
+- comments
+- categorizations

# cascaded in two levels with two has_many associations
>> Author.find(:all, :include=>{:posts=>[:comments, :categorizations]})
=> authors
+- posts
+- comments
+- categorizations

# cascaded in three levels
>> Company.find(:all, :include=>{:groups=>{:members=>{:favorites}}})
=> companies
+- groups
+- members
+- favorites

* Make counter cache work when replacing an association #3245 [eugenol@gmail.com]

* Make migrations verbose [Jamis Buck]
Expand Down
Loading

0 comments on commit 55854c4

Please sign in to comment.