class ActiveRecord::Relation
Public Instance Methods
difference(other)
click to toggle source
# File lib/active_record/setops.rb, line 22 def difference(other) binary_operation(Arel::Nodes::Except, other) end
Also aliased as: -
intersect(other)
click to toggle source
# File lib/active_record/setops.rb, line 17 def intersect(other) binary_operation(Arel::Nodes::Intersect, other) end
Also aliased as: &
union(other)
click to toggle source
Performs a set theoretic union works like `Array#+` but puts the load on the database and allows you to chain more relation operations.
# File lib/active_record/setops.rb, line 7 def union(other) binary_operation(Arel::Nodes::Union, other) end
Also aliased as: |
union_all(other)
click to toggle source
# File lib/active_record/setops.rb, line 12 def union_all(other) binary_operation(Arel::Nodes::UnionAll, other) end
Also aliased as: +
Private Instance Methods
binary_operation(op_class, other)
click to toggle source
# File lib/active_record/setops.rb, line 29 def binary_operation(op_class, other) @klass.unscoped.from(Arel::Nodes::TableAlias.new(op_class.new(self.arel.ast, other.arel.ast), @klass.arel_table.name)) end