method

precompile_filters

rails latest stable - Class: ActiveSupport::ParameterFilter
precompile_filters(filters)
public

Precompiles an array of filters that otherwise would be passed directly to #initialize. Depending on the quantity and types of filters, precompilation can improve filtering performance, especially in the case where the ParameterFilter instance itself cannot be retained (but the precompiled filters can be retained).

filters = [/foo/, :bar, "nested.baz", /nested\.qux/]

precompiled = ActiveSupport::ParameterFilter.precompile_filters(filters)
# => [/(?-mix:foo)|(?i:bar)/, /(?i:nested\.baz)|(?-mix:nested\.qux)/]

ActiveSupport::ParameterFilter.new(precompiled)