diff --git a/lib/will_paginate/view_helpers/link_renderer.rb b/lib/will_paginate/view_helpers/link_renderer.rb index 8e5c81f88..32e7f2a69 100644 --- a/lib/will_paginate/view_helpers/link_renderer.rb +++ b/lib/will_paginate/view_helpers/link_renderer.rb @@ -115,12 +115,12 @@ def rel_value(page) end def symbolized_update(target, other, blacklist = nil) - other.each do |key, value| + other.each_pair do |key, value| key = key.to_sym existing = target[key] next if blacklist && blacklist.include?(key) - if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?) + if value.respond_to?(:each_pair) and (existing.is_a?(Hash) or existing.nil?) symbolized_update(existing || (target[key] = {}), value) else target[key] = value diff --git a/spec/view_helpers/action_view_spec.rb b/spec/view_helpers/action_view_spec.rb index 297797f56..243a7da89 100644 --- a/spec/view_helpers/action_view_spec.rb +++ b/spec/view_helpers/action_view_spec.rb @@ -416,7 +416,7 @@ class DummyRequest def initialize(controller) @controller = controller @get = true - @params = {} + @params = {}.with_indifferent_access @symbolized_path_parameters = { :controller => 'foo', :action => 'bar' } end @@ -442,7 +442,11 @@ def script_name def params(more = nil) @params.update(more) if more - @params + if defined?(ActionController::Parameters) + ActionController::Parameters.new(@params) + else + @params + end end def host_with_port @@ -458,3 +462,7 @@ def protocol 'http:' end end + +if defined?(ActionController::Parameters) + ActionController::Parameters.permit_all_parameters = false +end