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

Iterations aren't reseted after the first usage #104

Open
GCorbel opened this issue Apr 15, 2019 · 1 comment
Open

Iterations aren't reseted after the first usage #104

GCorbel opened this issue Apr 15, 2019 · 1 comment

Comments

@GCorbel
Copy link
Contributor

GCorbel commented Apr 15, 2019

When we use an iterable, the first time we have the complete list of results but the next time we have only the last page. Here is an example :

responses = SurveyGizmo::API::Survey.first(id: 90063118).responses # => #<Enumerator: ...>
responses.count # => 558
responses.count # => 8

As you can see, the first time we have 558 results but the second time we have only 8. I suppose we always want to have all the results. The simple solution is to store the result with a .to_a but this is just a work around.

WDYT?

@jarthod
Copy link
Collaborator

jarthod commented Apr 17, 2019

Yep this is not good, it should either stop returning anything and force you to create another iterator or reset and start from scratch (that's a bit more tricky when you iterate one by one, you don't want to go in an infinite loop ^^)

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

2 participants