Module: ActiveRecordExtended::RelationPatch::Merger

Defined in:
lib/active_record_extended/active_record/relation_patch.rb

Instance Method Summary collapse

Instance Method Details

#mergeObject



20
21
22
23
# File 'lib/active_record_extended/active_record/relation_patch.rb', line 20

def merge
  merge_ctes!
  super
end

#merge_ctes!Object



25
26
27
28
29
30
31
32
33
# File 'lib/active_record_extended/active_record/relation_patch.rb', line 25

def merge_ctes!
  return unless other.with_values?

  if other.recursive_value? && !relation.recursive_value?
    relation.with!(:chain).recursive(other.cte)
  else
    relation.with!(other.cte)
  end
end

#normal_valuesObject



16
17
18
# File 'lib/active_record_extended/active_record/relation_patch.rb', line 16

def normal_values
  super + [:union, :define_window]
end