aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations/eager_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-15 23:50:12 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-15 23:50:12 +0000
commitb8657089f289e2b3a9d5c383516e951012b2bec2 (patch)
treeea1fadd57c9b983d36cbcbec382c1af9e8c5c9f1 /activerecord/test/associations/eager_test.rb
parenta6083b86d18e02f7e3824be7ec8ccbbdec625908 (diff)
downloadrails-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/associations/eager_test.rb')
-rw-r--r--activerecord/test/associations/eager_test.rb5
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 )