diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 11:01:19 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 11:01:19 -0700 |
commit | f3ebbeae6eb647767ccd49e25821b1ba33923596 (patch) | |
tree | 0fba1c6dbffa9700aed8c28b10cffe6061c18ecd /activerecord/test | |
parent | 50823452f70341447a010df27dd514fd97bfe8a9 (diff) | |
download | rails-f3ebbeae6eb647767ccd49e25821b1ba33923596.tar.gz rails-f3ebbeae6eb647767ccd49e25821b1ba33923596.tar.bz2 rails-f3ebbeae6eb647767ccd49e25821b1ba33923596.zip |
avoid creating a set if no where values are removed
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 3c1fae78ce..b64ff13d29 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1556,4 +1556,16 @@ class RelationTest < ActiveRecord::TestCase 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 |