提交 9dbcaeb9 编写于 作者: J Jon Leighton

Merge pull request #6605 from amatsuda/ar_merge_association_test

a test case that ensures AR::Relation#merge can merge associations
......@@ -695,6 +695,14 @@ def test_relation_merging_with_joins
assert_equal 1, comments.count
end
def test_relation_merging_with_association
assert_queries(2) do # one for loading post, and another one merged query
post = Post.where(:body => 'Such a lovely day').first
comments = Comment.where(:body => 'Thank you for the welcome').merge(post.comments)
assert_equal 1, comments.count
end
end
def test_count
posts = Post.scoped
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册