Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/setops.rb

Instance Method Summary collapse

Instance Method Details

#difference(other) ⇒ Object Also known as: -



22
23
24
# File 'lib/active_record/setops.rb', line 22

def difference(other)
  binary_operation(Arel::Nodes::Except, other)
end

#intersect(other) ⇒ Object Also known as: &



17
18
19
# File 'lib/active_record/setops.rb', line 17

def intersect(other)
  binary_operation(Arel::Nodes::Intersect, other)
end

#union(other) ⇒ Object Also known as: |

Performs a set theoretic union works like ‘Array#+` but puts the load on the database and allows you to chain more relation operations.



7
8
9
# File 'lib/active_record/setops.rb', line 7

def union(other)
  binary_operation(Arel::Nodes::Union, other)
end

#union_all(other) ⇒ Object Also known as: +



12
13
14
# File 'lib/active_record/setops.rb', line 12

def union_all(other)
  binary_operation(Arel::Nodes::UnionAll, other)
end