From b8657089f289e2b3a9d5c383516e951012b2bec2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 15 Sep 2007 23:50:12 +0000 Subject: Eager loading respects explicit :joins. Closes #9496. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations/eager_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/associations/eager_test.rb') 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 ) -- cgit v1.2.3