module ActiveRecord::WithMerger

def merge

def merge
  super
  merge_withs
  relation
end

def merge_withs

def merge_withs
  relation.recursive_with = true if other.recursive_with?
  other_values = other.with_values.reject { |value| relation.with_values.include?(value) }
  relation.with!(*other_values) if other_values.any?
end