diff --git a/lib/couchrest/mixins/collection.rb b/lib/couchrest/mixins/collection.rb index 3af8d74..b492dbe 100644 --- a/lib/couchrest/mixins/collection.rb +++ b/lib/couchrest/mixins/collection.rb @@ -209,12 +209,14 @@ module CouchRest def remember_where_we_left_off(results, page) last_row = results['rows'].last - @last_key = last_row['key'] - @last_docid = last_row['id'] + if last_row + @last_key = last_row['key'] + @last_docid = last_row['id'] + end @last_page = page end end end end -end \ No newline at end of file +end