ActionController::UnfilteredParameters - unable to convert unpermitted parameters to hash
aniketstiwari opened this issue · 2 comments
I am getting this error
Error: ActionController::UnfilteredParameters - unable to convert unpermitted parameters to hash
Issue On my this line
<%= will_paginate @users, url: request.path, renderer: FoundationPagination::Rails %>
When I try to debug the will_paginate method inside will_paginate/view_helpers.rb
def will_paginate(collection, options = {})
# early exit if there is nothing to render
return nil unless collection.total_pages > 1
options = WillPaginate::ViewHelpers.pagination_options.merge(options)
options[:previous_label] ||= will_paginate_translate(:previous_label) { '← Previous' }
options[:next_label] ||= will_paginate_translate(:next_label) { 'Next →' }
# get the renderer instance
renderer = case options[:renderer]
when nil
raise ArgumentError, ":renderer not specified"
when String
klass = if options[:renderer].respond_to? :constantize then options[:renderer].constantize
else Object.const_get(options[:renderer]) # poor man's constantize
end
klass.new
when Class then options[:renderer].new
else options[:renderer]
end
# render HTML for pagination
renderer.prepare collection, options, self
output = renderer.to_html
output = output.html_safe if output.respond_to?(:html_safe)
output
end
output = renderer.to_html # this line is causing the issue
so when I check the renderer
@base_url_params=
{:utf8=>"✓",
:q=>
{:user_name_count=>"Innovatio",
:combinator=>"or",
:groupings=>[<ActionController::Parameters {"user_name_count"=>"Innovatio"} permitted: false>]},
:commit=>"Search",
:controller=>"users",
:action=>"index",
:only_path=>true},
So I believe instead of ActionController::Parameters in groupings it should be a hash but not sure. Can anyone help me out with it
I started having this problem too: after an upgrade to rails 5.1.7, while running will_paginate v3.0.12.
This SO post says the problem seems fixed in more recent versions of will_paginate; it mentions 3.17, which I take to mean 3.1.7. I upgraded to 3.2.1, and it does seem to have fixed the problem for me.
Thanks; will assume that this was fixed. Please holler if that is not the case!