Class: ActiveModel::MassAssignmentSecurity::Sanitizer
- Inherits:
-
Object
- Object
- ActiveModel::MassAssignmentSecurity::Sanitizer
- Defined in:
- lib/active_model/mass_assignment_security/sanitizer.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(target = nil) ⇒ Sanitizer
constructor
A new instance of Sanitizer.
-
#sanitize(attributes, authorizer) ⇒ Object
Returns all attributes not denied by the authorizer.
Constructor Details
#initialize(target = nil) ⇒ Sanitizer
Returns a new instance of Sanitizer.
6 7 |
# File 'lib/active_model/mass_assignment_security/sanitizer.rb', line 6 def initialize(target=nil) end |
Instance Method Details
#sanitize(attributes, authorizer) ⇒ Object
Returns all attributes not denied by the authorizer.
10 11 12 13 14 |
# File 'lib/active_model/mass_assignment_security/sanitizer.rb', line 10 def sanitize(attributes, ) sanitized_attributes = attributes.reject { |key, value| .deny?(key) } debug_protected_attribute_removal(attributes, sanitized_attributes) sanitized_attributes end |