From a513f8f8bb3c4fff88ab27a8f2c591d9d7c27cf9 Mon Sep 17 00:00:00 2001 From: Marcelo Giorgi Date: Wed, 8 Sep 2010 21:55:05 -0300 Subject: intersection between a relation and an array works in both directions Signed-off-by: Mikel Lindsaar --- activerecord/lib/active_record/relation/spawn_methods.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index f039645255..9ecdb99bee 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -5,6 +5,7 @@ module ActiveRecord def merge(r) merged_relation = clone return merged_relation unless r + return to_a & r if r.is_a?(Array) Relation::ASSOCIATION_METHODS.each do |method| value = r.send(:"#{method}_values") -- cgit v1.2.3