Created
February 10, 2011 18:57
-
-
Save schovi/821099 to your computer and use it in GitHub Desktop.
Quick WillPaginate fix, after that will_paginate method will accept param :url => my_route_path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WillPaginate::ViewHelpers::LinkRenderer | |
def url(page) | |
@base_url_params ||= begin | |
url_params = base_url_params | |
merge_optional_params(url_params) | |
url_params | |
end | |
url_params = @base_url_params.dup | |
add_current_page_param(url_params, page) | |
@options[:url] ? merge_parameters_with_string_url(@options[:url], url_params) : @template.url_for(url_params) | |
end | |
def merge_parameters_with_string_url(url, url_params) | |
url_params = url_params.except(:escape, :controller, :action) | |
string_attributes = url_params.collect do |key, val| | |
"#{key}=#{CGI::escapeHTML(val.to_s)}" | |
end | |
url + "?#{string_attributes.join("&")}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment