Skip to content

Commit 83111ec

Browse files
authored
Don't force a CSV collection to render in batches if it has an ordering (#162)
1 parent 9c2f920 commit 83111ec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/phlex/rails/csv.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ module Rails
55
module CSV
66
module Overrides
77
def each_item(&block)
8-
case collection
9-
when ActiveRecord::Relation
10-
collection.find_each(&block)
11-
else
12-
super
13-
end
8+
return super unless collection.is_a?(ActiveRecord::Relation)
9+
return super unless collection.arel.orders.empty?
10+
11+
collection.find_each(&block)
1412
end
1513
end
1614
end

0 commit comments

Comments
 (0)