Skip to content

Commit 19ef353

Browse files
committed
Merge pull request #14 from macb/master
Avoid dividing by 0
2 parents 7338f5f + 0806da5 commit 19ef353

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/api-pagination.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class << self
77

88
def paginate(collection, options = {})
99
options[:page] ||= 1
10-
options[:per_page] ||= 25
10+
options[:per_page] = (options[:per_page].to_i <= 0 ? 25 : options[:per_page])
1111

1212
case ApiPagination.paginator
1313
when :kaminari

0 commit comments

Comments
 (0)