Forum: Ruby on Rails <%= pagination_links(@pages) %>, next/previos link

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Be5736b3bc77d526585c1f17b6692520?d=identicon&s=25 mixplate (Guest)
on 2007-02-20 04:55
hi, im trying to get next and previous page links but how?

i saw this:

<%= link_to "Previous page", { :page => paginator.current.previous } if
paginator.current.previous %>

<%= link_to "Next page", { :page => } if %>

but dont know how to get it configured with what i have.
Be5736b3bc77d526585c1f17b6692520?d=identicon&s=25 mixplate (Guest)
on 2007-02-20 04:57
this is my function i use...

  def paginate_collection(collection, options = {})
    logger.debug "----~CALLING PAGIONATE!!!!== "
    default_options = {:per_page => 1, :page => 1}
    options = default_options.merge options

    pages = self, collection.size, options[:per_page],
    first = pages.current.offset
    last = [first + options[:per_page], collection.size].min
    slice = collection[first...last]
    return [pages, slice]
This topic is locked and can not be replied to.