Iterations aren't reseted after the first usage
GCorbel opened this issue · 1 comments
GCorbel commented
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 commented
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 ^^)