Skip to content

Commit

Permalink
Merge pull request #6605 from amatsuda/ar_merge_association_test
Browse files Browse the repository at this point in the history
a test case that ensures AR::Relation#merge can merge associations
  • Loading branch information
jonleighton committed Jun 3, 2012
2 parents 806d023 + 37a4dd5 commit 9dbcaeb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions activerecord/test/cases/relations_test.rb
Expand Up @@ -695,6 +695,14 @@ def test_relation_merging_with_joins
assert_equal 1, comments.count assert_equal 1, comments.count
end 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 def test_count
posts = Post.scoped posts = Post.scoped


Expand Down

0 comments on commit 9dbcaeb

Please sign in to comment.