Recent Changes - Search:

edit SideBar


Firefox 2
Get Thunderbird!

PaginateOverACollection

Rails.PaginateOverACollection History

Hide minor edits - Show changes to markup

February 17, 2007, at 06:35 AM by 85.105.66.26
Added lines 1-12:

(:code:) def paginate_collection(collection, options = {}) default_options = {:per_page => 10, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collection.size].min slice = collection[first...last] return [pages, slice] end

Edit - History - Print - Recent Changes - Search
Page last modified on February 17, 2007, at 06:35 AM