Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stringified_merge -> symbolized_update. work with symbol keys instead…

… of strings
  • Loading branch information...
commit 2039231b9ec187572d5fa2c1a4d5c58eab84a4be 1 parent 1c625fc
@mislav mislav authored
View
1  lib/will_paginate/view_helpers/action_view.rb
@@ -1,4 +1,3 @@
-require 'will_paginate/core_ext'
require 'will_paginate/view_helpers/base'
require 'action_view'
require 'will_paginate/view_helpers/link_renderer'
View
1  lib/will_paginate/view_helpers/base.rb
@@ -1,3 +1,4 @@
+require 'will_paginate/core_ext'
require 'will_paginate/view_helpers'
module WillPaginate
View
13 lib/will_paginate/view_helpers/link_renderer.rb
@@ -1,3 +1,4 @@
+require 'cgi'
require 'will_paginate/core_ext'
require 'will_paginate/view_helpers/link_renderer_base'
@@ -96,7 +97,7 @@ def default_url_params
url_params = { :escape => false }
if @template.request.get?
# page links should preserve GET parameters
- stringified_merge(url_params, @template.params)
+ symbolized_update(url_params, @template.params)
end
url_params
end
@@ -108,12 +109,12 @@ def add_current_page_param(url_params, page)
page_param = (defined?(CGIMethods) ? CGIMethods : ActionController::AbstractRequest).
parse_query_parameters(param_name + '=' + page.to_s)
- stringified_merge(url_params, page_param)
+ symbolized_update(url_params, page_param)
end
end
def merge_optional_params(url_params)
- stringified_merge(url_params, @options[:params]) if @options[:params]
+ symbolized_update(url_params, @options[:params]) if @options[:params]
end
private
@@ -145,15 +146,15 @@ def rel_value(page)
end
end
- def stringified_merge(target, other)
+ def symbolized_update(target, other)
other.each do |key, value|
- key = key.to_s
+ key = key.to_sym
existing = target[key]
if value.is_a?(Hash)
target[key] = existing = {} if existing.nil?
if existing.is_a?(Hash)
- stringified_merge(existing, value)
+ symbolized_update(existing, value)
return
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.