diff options
Diffstat (limited to 'activerecord/lib/active_record/relation/spawn_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 80c129d361..40af665769 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -5,10 +5,13 @@ module ActiveRecord module SpawnMethods def merge(other) if other - if other.is_a?(Array) + case other + when Array to_a & other + when Hash + Relation::HashMerger.new(clone, other).merge else - ActiveRecord::Relation::Merger.new(clone, other).merge + Relation::Merger.new(clone, other).merge end else self |