Skip to content

Commit

Permalink
Don't force a CSV collection to render in batches if it has an ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
willcosgrove committed Mar 16, 2024
1 parent c826046 commit a39b2e8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/phlex/rails/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ module Rails
module CSV
module Overrides
def each_item(&block)
case collection
when ActiveRecord::Relation
collection.find_each(&block)
else
super
end
return super unless collection.is_a?(ActiveRecord::Relation)
return super unless collection.arel.orders.empty?

collection.find_each(&block)
end
end
end
Expand Down

0 comments on commit a39b2e8

Please sign in to comment.