Permalink
Browse files

intersection between a relation and an array works in both directions

Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
  • Loading branch information...
marklazz authored and mikel committed Sep 9, 2010
1 parent 1c28376 commit a513f8f8bb3c4fff88ab27a8f2c591d9d7c27cf9
Showing with 1 addition and 0 deletions.
  1. +1 −0 activerecord/lib/active_record/relation/spawn_methods.rb
@@ -5,6 +5,7 @@ module SpawnMethods
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")

0 comments on commit a513f8f

Please sign in to comment.