diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-19 08:28:57 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-19 08:28:57 -0700 |
commit | 1dbf1c80ac4693634f536b410e7d4910cc2e173f (patch) | |
tree | 687385bd46b8a6d0761ea35fc82e9e6417c5eccb /activerecord/test/cases | |
parent | f9fc26e8007d5e2936cf5374a8168b2c37273490 (diff) | |
parent | bf80522be4d7ac521fa3c30d889afa68450a0bc2 (diff) | |
download | rails-1dbf1c80ac4693634f536b410e7d4910cc2e173f.tar.gz rails-1dbf1c80ac4693634f536b410e7d4910cc2e173f.tar.bz2 rails-1dbf1c80ac4693634f536b410e7d4910cc2e173f.zip |
Merge pull request #7392 from ernie/real-fix-for-last-equality-wins-in-merge
Fix "last equality wins" logic in relation merge
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 4ef11590a9..684538940a 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -675,11 +675,14 @@ class RelationTest < ActiveRecord::TestCase assert_equal [developers(:poor_jamis)], devs.to_a end - def test_relation_merging_with_arel_equalities_with_a_non_attribute_left_hand_ignores_non_attributes_when_discarding_equalities + def test_relation_merging_with_arel_equalities_keeps_last_equality_with_non_attribute_left_hand salary_attr = Developer.arel_table[:salary] - devs = Developer.where(salary_attr.eq(80000)).merge( - Developer.where(salary_attr.eq(9000)). - where(Arel::Nodes::NamedFunction.new('abs', [salary_attr]).eq(9000)) + devs = Developer.where( + Arel::Nodes::NamedFunction.new('abs', [salary_attr]).eq(80000) + ).merge( + Developer.where( + Arel::Nodes::NamedFunction.new('abs', [salary_attr]).eq(9000) + ) ) assert_equal [developers(:poor_jamis)], devs.to_a end |