jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
910 stars 124 forks source link

Scope pattern "Multiple form inputs for single scope" does not work if one of them is multi-select #142

Open awh-tokyo opened 7 years ago

awh-tokyo commented 7 years ago

If my inputs are as follows:

Parameters: {"utf8"=>"✓", "filterrific"=>{"with_tags"=>{"and_or"=>"or", "tags"=>["10", "12", "6"]}, "searchquery"=>""}, ""=>"1504129085411"}

I end up with "Unpermitted parameter: tags".

I've traced it down to the following lines in param_set.rb:

      if filterrific_params[p].is_a?(ActionController::Parameters)
        permissible_filter_params << { p => filterrific_params[p].keys }

which does not account for arrays inside ActionController::Parameters.

Rather than trying to account for every possible situation, would it make sense to allow for explicit setting of permissible_filter_params in the opts to initialize_filterrific?

raegertay commented 6 years ago

Hi, I was having the same issue. I managed to resolve it using this particular commit.

Enter this into your gemfile: gem 'filterrific', :git => 'https://github.com/jhund/filterrific.git', :ref => '292ecd953df4ec70f2f9a879105ef5aba5b77e95'

BlazPerus commented 5 years ago

This issue still persists.. if one of the HTTP parameters is hash/array it will throw an unpermitted parameter error.