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
911 stars 125 forks source link

Fix nested array attributes #213

Open phylor opened 2 years ago

phylor commented 2 years ago

This PR fixes nested array attributes. It seems to be a duplicate of #116 and/or #178. @jhund It would be great if one of these solutions could be merged!

Suppose one sends the following parameters as a filter:

filter_nested_params: {
  an_array: %w[one two three],
  a_string: "one"
}

This currently only permits a_string, because an_array would need to be permitted using an_array: [].

The following works fine though (it's only a problem when nested):

filter_array_string: %w[one two three]

I would suggest to change the existing code to permit all available filters, independent of how deep they are nested.

neilvcarvalho commented 1 year ago

Oops, I seem to have fixed the same issue you're solving here on #226, and I like your approach better