Skip to content

Commit

Permalink
Don't force a CSV collection to render in batches if it has an orderi…
Browse files Browse the repository at this point in the history
…ng (#162)
  • Loading branch information
willcosgrove authored Mar 16, 2024
1 parent 9c2f920 commit 83111ec
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 83111ec

Please sign in to comment.