8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/moderate_parameters/parameters.rb', line 8
def moderate(controller_name, action, *filters)
log_duplicate_moderate_warning(
caller_locations,
instance_variable_get(MP_PARENT_KEY),
controller_name,
action
) if instance_variable_get(MP_OBJECT_ID)
params = self.class.new
filters.each do |filter|
case filter
when Symbol, String
if non_scalar?(self[filter])
non_scalar_value_filter(params, filter, controller_name, action)
else
permitted_scalar_filter(params, filter)
end
when Hash
cust_hash_filter(params, filter, controller_name, action)
end
end
incoming_params_logging(params, controller_name, action)
duplicate_params = dup
instance_variable_set(MP_OBJECT_ID, duplicate_params.object_id)
duplicate_params.permit!
end
|