summaryrefslogtreecommitdiff
path: root/config/initializers/will_paginate_patch.rb
blob: d03c88286856fb923493fb9825eb8b3dbf2983de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'will_paginate/view_helpers/action_view'

WillPaginate::ActionView::LinkRenderer.class_eval do
  def url(page)
    path = @template.request.path
    page_param = WillPaginate::PageNumber(page)
    if page_param == 1
      path
    else
      "#{path}?#{@options[:param_name]}=#{page}"
    end
  end
end