aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-08-24 19:12:05 +0300
committerPaul Nikitochkin <paul.nikitochkin@gmail.com>2013-09-13 16:37:10 +0300
commitfbbb6c87fd5e8fcd913c0dbf518024edd7538072 (patch)
tree0663c678b8a52e45de6eb2e86d8ead0d65fb543f /activerecord/test/cases
parent97a19c6b4b71d1e12d62d880ec8c8eed357b3d3c (diff)
downloadrails-fbbb6c87fd5e8fcd913c0dbf518024edd7538072.tar.gz
rails-fbbb6c87fd5e8fcd913c0dbf518024edd7538072.tar.bz2
rails-fbbb6c87fd5e8fcd913c0dbf518024edd7538072.zip
Collapse where constraints to one where constraint
In order to remove duplication with joining arel where constraints with `AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And` Closes: #11963
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/inner_join_association_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb
index de47a576c6..9fe5ff50d9 100644
--- a/activerecord/test/cases/associations/inner_join_association_test.rb
+++ b/activerecord/test/cases/associations/inner_join_association_test.rb
@@ -41,6 +41,11 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase
assert_no_match(/WHERE/i, sql)
end
+ def test_join_association_conditions_support_string_and_arel_expressions
+ assert_equal 0, Author.joins(:welcome_posts_with_comment).count
+ assert_equal 1, Author.joins(:welcome_posts_with_comments).count
+ end
+
def test_join_conditions_allow_nil_associations
authors = Author.includes(:essays).where(:essays => {:id => nil})
assert_equal 2, authors.count