1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

intersection between a relation and an array works in both directions

Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
This commit is contained in:
Marcelo Giorgi 2010-09-08 21:55:05 -03:00 committed by Mikel Lindsaar
parent 1c283765b6
commit a513f8f8bb

View file

@ -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")