lib/rom/ra/operation/group.rb in rom-0.4.1 vs lib/rom/ra/operation/group.rb in rom-0.4.2
- old
+ new
@@ -18,12 +18,10 @@
end
def each(&block)
return to_enum unless block
- tuples = relation.to_a
-
- result = tuples.each_with_object({}) do |tuple, grouped|
+ result = relation.each_with_object({}) do |tuple, grouped|
left = tuple.reject { |k,_| attribute_names.include?(k) }
right = tuple.reject { |k,_| !attribute_names.include?(k) }
grouped[left] ||= {}
grouped[left][key] ||= []