diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 11:01:25 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 11:01:25 -0700 |
commit | ac70ec64138765ddd2a7c5e0130243e6df98cf2d (patch) | |
tree | 3cc3eb3ee81e314fbd60dcabafda0aa40850b382 /activerecord/test/cases/relations_test.rb | |
parent | f47b4236e089b07cb683ee9b7ff8b06111a0ec10 (diff) | |
parent | f3ebbeae6eb647767ccd49e25821b1ba33923596 (diff) | |
download | rails-ac70ec64138765ddd2a7c5e0130243e6df98cf2d.tar.gz rails-ac70ec64138765ddd2a7c5e0130243e6df98cf2d.tar.bz2 rails-ac70ec64138765ddd2a7c5e0130243e6df98cf2d.zip |
Merge branch 'bindwhere'
* bindwhere:
avoid creating a set if no where values are removed
remove bind values for where clauses that were removed
push partitioning up so bind elimination can get the removed wheres
push partion logic down and initialization logic up
partition the where values so we can access the removed ones
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index cf6af4e8f4..b64ff13d29 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1546,4 +1546,26 @@ class RelationTest < ActiveRecord::TestCase assert merged.to_sql.include?("wtf") assert merged.to_sql.include?("bbq") end + + def test_merging_removes_rhs_bind_parameters + left = Post.where(id: Arel::Nodes::BindParam.new('?')) + column = Post.columns_hash['id'] + left.bind_values += [[column, 20]] + right = Post.where(id: 10) + + merged = left.merge(right) + assert_equal [], merged.bind_values + end + + def test_merging_keeps_lhs_bind_parameters + column = Post.columns_hash['id'] + binds = [[column, 20]] + + right = Post.where(id: Arel::Nodes::BindParam.new('?')) + right.bind_values += binds + left = Post.where(id: 10) + + merged = left.merge(right) + assert_equal binds, merged.bind_values + end end |