diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-15 23:50:12 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-09-15 23:50:12 +0000 |
commit | b8657089f289e2b3a9d5c383516e951012b2bec2 (patch) | |
tree | ea1fadd57c9b983d36cbcbec382c1af9e8c5c9f1 /activerecord/test | |
parent | a6083b86d18e02f7e3824be7ec8ccbbdec625908 (diff) | |
download | rails-b8657089f289e2b3a9d5c383516e951012b2bec2.tar.gz rails-b8657089f289e2b3a9d5c383516e951012b2bec2.tar.bz2 rails-b8657089f289e2b3a9d5c383516e951012b2bec2.zip |
Eager loading respects explicit :joins. Closes #9496.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/associations/eager_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/associations/eager_test.rb b/activerecord/test/associations/eager_test.rb index bbf3edd0c9..fa632bdf69 100644 --- a/activerecord/test/associations/eager_test.rb +++ b/activerecord/test/associations/eager_test.rb @@ -103,6 +103,11 @@ class EagerAssociationTest < Test::Unit::TestCase assert_equal [2], posts.collect { |p| p.id } end + def test_eager_association_loading_with_explicit_join + posts = Post.find(:all, :include => :comments, :joins => "INNER JOIN authors ON posts.author_id = authors.id AND authors.name = 'Mary'", :limit => 1, :order => 'author_id') + assert_equal 1, posts.length + end + def test_eager_with_has_many_through posts_with_comments = people(:michael).posts.find(:all, :include => :comments) posts_with_author = people(:michael).posts.find(:all, :include => :author ) |