aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_go_eager_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-04 23:33:10 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-04 23:33:10 +0000
commit55854c4195177d2d5cbf0497c77e63b24cb76074 (patch)
tree7fc8154d16a0fef79b20fab53d3c2070307b23ee /activerecord/test/associations_go_eager_test.rb
parent30caefdfc794b8b828a50663dc0b933431273092 (diff)
downloadrails-55854c4195177d2d5cbf0497c77e63b24cb76074.tar.gz
rails-55854c4195177d2d5cbf0497c77e63b24cb76074.tar.bz2
rails-55854c4195177d2d5cbf0497c77e63b24cb76074.zip
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]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3769 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_go_eager_test.rb')
-rw-r--r--activerecord/test/associations_go_eager_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/associations_go_eager_test.rb b/activerecord/test/associations_go_eager_test.rb
index 1bc9d9f982..2212596099 100644
--- a/activerecord/test/associations_go_eager_test.rb
+++ b/activerecord/test/associations_go_eager_test.rb
@@ -92,15 +92,15 @@ class EagerAssociationTest < Test::Unit::TestCase
end
def test_eager_association_loading_with_belongs_to_and_limit_and_multiple_associations
- posts = Post.find(:all, :include => [:author, :very_special_comment], :limit => 1)
+ posts = Post.find(:all, :include => [:author, :very_special_comment], :limit => 1, :order => 'posts.id')
assert_equal 1, posts.length
- assert_equal [4], posts.collect { |p| p.id }
+ assert_equal [3], posts.collect { |p| p.id }
end
def test_eager_association_loading_with_belongs_to_and_limit_and_offset_and_multiple_associations
- posts = Post.find(:all, :include => [:author, :very_special_comment], :limit => 1, :offset => 1)
- assert_equal 0, posts.length
- assert_equal [], posts
+ posts = Post.find(:all, :include => [:author, :very_special_comment], :limit => 1, :offset => 1, :order => 'posts.id')
+ assert_equal 1, posts.length
+ assert_equal [4], posts.collect { |p| p.id }
end
def test_eager_with_has_many_through