Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering an Enumerator with Puma > 6 #3219

Closed
tomrossi7 opened this issue Sep 1, 2023 · 3 comments
Closed

Rendering an Enumerator with Puma > 6 #3219

tomrossi7 opened this issue Sep 1, 2023 · 3 comments

Comments

@tomrossi7
Copy link

When upgrading from Puma 5 -> 6, we began receiving an undefined method to_ary error:

Read: #<NoMethodError: undefined method `to_ary' for #<Enumerator: #<Enumerator::Generator:0x000000011e938568>:each>>

We are using this to stream large CSV files while they are being generated. The body being being passed is an Enumerator built from an ActiveRecord collection.

@dentarg
Copy link
Member

dentarg commented Sep 1, 2023

This is not a problem in Puma: #3112 (comment)

Are you using Rails? Maybe you are running into rails/rails@0174283

@tomrossi7
Copy link
Author

We were able to fix the issue by using the ActionController#send_stream method.. Previously, we just set the body equal to the enumerator object.

@cimm
Copy link

cimm commented Jan 10, 2024

We had the same error in Rails 7.1.1, upgrading Rails to 7.1.2 fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants