Class: ActiveModel::MassAssignmentSecurity::Sanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/ab_admin/hooks/active_model_hooks.rb

Instance Method Summary collapse

Instance Method Details

#sanitize(attributes, authorizers) ⇒ Object



23
24
25
26
27
# File 'lib/ab_admin/hooks/active_model_hooks.rb', line 23

def sanitize(attributes, authorizers)
  sanitized_attributes = attributes.reject { |key, value| authorizers.all? { |auth| auth.deny?(key) } }
  debug_protected_attribute_removal(attributes, sanitized_attributes)
  sanitized_attributes
end