Upgrading custom WillPaginate renders of Rails 2.3 to Rails 3.0 #281

conradwt opened this Issue Dec 19, 2012 · 1 comment


None yet
2 participants

I'm in the process of upgrading the current custom link renders used in Rails 2.3 to using will_paginage for Rails 3.x. Next, I have 2 structures that I need to convert:

class LinkRender1 < WillPaginate::LinkRenderer
  def page_link(page, text, attributes = {})
    @template.link_to( text, 
                       { :controller => :posts, 
                         :action => :index, 
                         :page => page,
                         :topic_id => @options[:topic_id] },
                         attributes.merge!(  method: :get, :remote => true ) )


class LinkRender2 < WillPaginate::LinkRenderer
 def to_html
    links = @options[:page_links] ? windowed_links : []
    # previous/next buttons
    links.unshift page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label])
    links.push    page_link_or_span(@collection.next_page,     'disabled next_page', @options[:next_label])
    links.push    page_link_or_span("all", 'disabled next_page', "Show All Trips")

    html = links.join(@options[:separator])
    @options[:container] ? @template.content_tag(:div, html, html_attributes) : html

Note: For the above renderer, the windowed_links method appears to be undefined within LinkRenderer2.

It's not clear from the documentation as to which method one needs to override. Thus, is there some additional documentation on the subject which can assist one in the upgrade process?


mislav commented Jan 10, 2013

Nope, no documentation. You'll just have to figure it out by reading the source code

mislav closed this Jan 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment