method

array_filter?

rails latest stable - Class: ActionController::Parameters

Method not available on this version

This method is only available on newer versions. The first available version (v8.0.0) is shown here.

array_filter?(filter)
private

When an array is expected, you must specify an array explicitly using the following format:

params.expect(comments: [[:flavor]])

Which will match only the following array formats:

{ pies: [{ flavor: "rhubarb" }, { flavor: "apple" }] }
{ pies: { "0" => { flavor: "key lime" }, "1" =>  { flavor: "mince" } } }

When using `permit`, arrays are specified the same way as hashes:

params.expect(pies: [:flavor])

In this case, `permit` would also allow matching with a hash (or vice versa):

{ pies: { flavor: "cherry" } }