mirror of
https://github.com/github/rails.git
synced 2026-02-16 09:05:14 -05:00
Association preloading no longer stops if it hits a nil object [#1630 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
This commit is contained in:
committed by
Frederick Cheung
parent
c9d4335418
commit
eb457ceee1
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user