From 55854c4195177d2d5cbf0497c77e63b24cb76074 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 4 Mar 2006 23:33:10 +0000 Subject: 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 --- activerecord/test/associations_go_eager_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/test/associations_go_eager_test.rb') 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 -- cgit v1.2.3