I am using the will_paginate gem and ransack gem in a rails 5.2 app. When I search or sort I get the following error:
unable to convert unpermitted parameters to hash
The highlighted line of code is this:
tag :li, link(page, page, :rel => rel_value(page)), class: classes
The good people at Ransack have their own will_paginate fork that solves the issue. However, that fork doesn't include the very nice page_entries_info
using page_entries_info
give an error about an array.
Has anyone solved these issues with will_paginate and Rails 5.2?
Has anyone created a fork on github of will_paginate that resolves the issue?
I would be glad to contribute. Thanks!
You can create an initialize where you overwrite the symbolized_update method.
WillPaginate::ViewHelpers::LinkRenderer.class_eval do
def symbolized_update(target, other, blacklist = nil)
other.each_pair do |key, value|
key = key.to_sym
existing = target[key]
next if blacklist && blacklist.include?(key)
if value.respond_to?(:each_pair) and (existing.is_a?(Hash) or existing.nil?)
symbolized_update(existing || (target[key] = {}), value)
else
if value.instance_variable_defined?(:@parameters)
value = value.instance_variable_get(:@parameters)
end
target[key] = value
end
end
end
end