From 1c3cbed8666b8426bdba25839b26f3d048230dc1 Mon Sep 17 00:00:00 2001 From: kane Date: Wed, 8 Sep 2010 21:53:58 -0300 Subject: [PATCH 1/2] added a test for relation which checks intersection between a relation and an array works in both directions --- activerecord/test/cases/relations_test.rb | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index b7112d0..4daa626 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -688,5 +688,11 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'zyke', car.name end + def test_intersection_with_array + relation = Author.where(:name => "David") + rails_author = relation.first + assert_equal [rails_author], [rails_author] & relation + assert_equal [rails_author], relation & [rails_author] + end end -- 1.7.0.4