diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-25 17:30:42 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-25 17:30:42 -0700 |
commit | d6110799c2573080897410f9836f5aa623b197ea (patch) | |
tree | bfbfc983b3f8558d8dd85a042354c8eb59f333b9 /activerecord/test | |
parent | 7227e4fba17f4a50e53a5486a3b956a6c7c26697 (diff) | |
download | rails-d6110799c2573080897410f9836f5aa623b197ea.tar.gz rails-d6110799c2573080897410f9836f5aa623b197ea.tar.bz2 rails-d6110799c2573080897410f9836f5aa623b197ea.zip |
Move `where_unscoping` logic over to `WhereClause`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/where_clause_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_clause_test.rb b/activerecord/test/cases/relation/where_clause_test.rb index 569082541b..6864be2608 100644 --- a/activerecord/test/cases/relation/where_clause_test.rb +++ b/activerecord/test/cases/relation/where_clause_test.rb @@ -97,6 +97,20 @@ class ActiveRecord::Relation assert_equal expected, original.invert end + test "accept removes binary predicates referencing a given column" do + where_clause = WhereClause.new([ + table["id"].in([1, 2, 3]), + table["name"].eq(bind_param), + table["age"].gteq(bind_param), + ], [ + [column("name"), "Sean"], + [column("age"), 30], + ]) + expected = WhereClause.new([table["age"].gteq(bind_param)], [[column("age"), 30]]) + + assert_equal expected, where_clause.except("id", "name") + end + private def table |