diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-13 18:41:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-13 18:41:42 +0000 |
commit | 2c6e616b90483681ccaff7e04d47b88470a309b0 (patch) | |
tree | b81443a1e3d81c869ab49a3beff7d78eb4c1175a /activerecord/test | |
parent | 58c30f61351dae43900c3b6cb5dd3622f12ecee0 (diff) | |
download | rails-2c6e616b90483681ccaff7e04d47b88470a309b0.tar.gz rails-2c6e616b90483681ccaff7e04d47b88470a309b0.tar.bz2 rails-2c6e616b90483681ccaff7e04d47b88470a309b0.zip |
Fixed that scoped joins would not always be respected (closes #6821) [Theory/Danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/join_model_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 810e477ac0..1034cb67e9 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -299,6 +299,14 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert_equal [], posts(:thinking).authors assert_equal [authors(:mary)], posts(:authorless).authors end + + def test_both_scoped_and_explicit_joins_should_be_respected + assert_nothing_raised do + Post.send(:with_scope, :find => {:joins => "left outer join comments on comments.id = posts.id"}) do + Post.find :all, :select => "comments.id, authors.id", :joins => "left outer join authors on authors.id = posts.author_id" + end + end + end def test_belongs_to_polymorphic_with_counter_cache assert_equal 0, posts(:welcome)[:taggings_count] |