enumerator module in std. lib has #each_slice (and #each_cons) methods to do this "pagination" (take x items at a time from array Y) for you http://www.ruby-doc.org/stdlib/libdoc/enumerator/rdoc/