Module: ActiveRecordExtended::Patch::RelationPatch::Merger
- Defined in:
- lib/active_record_extended/patch/relation_patch.rb
Instance Method Summary collapse
Instance Method Details
#merge ⇒ Object
20 21 22 23 24 25 |
# File 'lib/active_record_extended/patch/relation_patch.rb', line 20 def merge merge_ctes! merge_union! merge_windows! super end |
#merge_ctes! ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/active_record_extended/patch/relation_patch.rb', line 41 def merge_ctes! return unless other.with_values? return relation.with!.recursive(other.cte) if other.recursive_value? && !relation.recursive_value? merge_by_values(relation, other) end |
#merge_union! ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/active_record_extended/patch/relation_patch.rb', line 27 def merge_union! return if other.unionize_storage.empty? relation.union_values += other.union_values relation.union_operations += other.union_operations relation.union_ordering_values += other.union_ordering_values end |
#merge_windows! ⇒ Object
35 36 37 38 39 |
# File 'lib/active_record_extended/patch/relation_patch.rb', line 35 def merge_windows! return unless other.window_values? relation.window_values |= other.window_values end |