Skip to content

Commit

Permalink
Fixes bug in paging where start index is greater than results size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Reeder committed Oct 16, 2010
1 parent 0407f58 commit a7921a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/simple_record/results_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ def each2(i, &blk)
limit = options[:limit]
# puts 'limit=' + limit.inspect

@items[i..@items.size].each do |v|
if i > @items.size
i = @items.size
end
range = i..@items.size
# puts 'range=' + range.inspect
@items[range].each do |v|
# puts "i=" + i.to_s
yield v
i += 1
Expand Down

0 comments on commit a7921a5

Please sign in to comment.