aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorPivotal Labs <opensource@pivotallabs.com>2008-12-24 14:57:09 -0800
committerFrederick Cheung <frederick.cheung@gmail.com>2008-12-26 18:25:50 +0000
commiteb457ceee13779ade67e1bdebd2919d476148277 (patch)
treeddaa96980a5b48f4e3d940c4545a2ab3a65a1a2d /activerecord/test
parentc9d4335418823500548ad8fbc86af7c910b7644b (diff)
downloadrails-eb457ceee13779ade67e1bdebd2919d476148277.tar.gz
rails-eb457ceee13779ade67e1bdebd2919d476148277.tar.bz2
rails-eb457ceee13779ade67e1bdebd2919d476148277.zip
Association preloading no longer stops if it hits a nil object [#1630 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/cascaded_eager_loading_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb
index 8c9ae8a031..45e74ea024 100644
--- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb
+++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb
@@ -104,6 +104,14 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
authors.first.posts.first.special_comments.first.post.very_special_comment
end
end
+
+ def test_eager_association_loading_where_first_level_returns_nil
+ authors = Author.find(:all, :include => {:post_about_thinking => :comments}, :order => 'authors.id DESC')
+ assert_equal [authors(:mary), authors(:david)], authors
+ assert_no_queries do
+ authors[1].post_about_thinking.comments.first
+ end
+ end
end
require 'models/vertex'