Class: ActiveModel::MassAssignmentSecurity::Sanitizer

### Home Classes Methods

### In Files

- lib/active_model/mass_assignment_security/sanitizer.rb

### Parent

Object

### Methods

- ::new
- #debug_protected_attribute_removal
- #process_removed_attributes
- #sanitize

### Class/Module Index

Quicksearch

- ActiveModel
- ActiveModel::AttributeMethods
- ActiveModel::AttributeMethods::ClassMethods
- ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher
- ActiveModel::BlockValidator
- ActiveModel::Callbacks
- ActiveModel::Conversion
- ActiveModel::Dirty
- ActiveModel::EachValidator
- ActiveModel::Errors
- ActiveModel::Lint
- ActiveModel::Lint::Tests
- ActiveModel::MassAssignmentSecurity
- ActiveModel::MassAssignmentSecurity::BlackList
- ActiveModel::MassAssignmentSecurity::ClassMethods
- ActiveModel::MassAssignmentSecurity::Error
- ActiveModel::MassAssignmentSecurity::LoggerSanitizer
- ActiveModel::MassAssignmentSecurity::PermissionSet
- ActiveModel::MassAssignmentSecurity::Sanitizer
- ActiveModel::MassAssignmentSecurity::StrictSanitizer
- ActiveModel::MassAssignmentSecurity::WhiteList
- ActiveModel::MissingAttributeError
- ActiveModel::Name
- ActiveModel::Naming
- ActiveModel::Observer
- ActiveModel::ObserverArray
- ActiveModel::Observing
- ActiveModel::Observing::ClassMethods
- ActiveModel::SecurePassword
- ActiveModel::SecurePassword::ClassMethods
- ActiveModel::SecurePassword::InstanceMethodsOnActivation
- ActiveModel::Serialization
- ActiveModel::Serializers
- ActiveModel::Serializers::JSON
- ActiveModel::Serializers::Xml
- ActiveModel::StrictValidationFailed
- ActiveModel::Translation
- ActiveModel::Validations
- ActiveModel::Validations::AcceptanceValidator
- ActiveModel::Validations::Callbacks
- ActiveModel::Validations::Callbacks::ClassMethods
- ActiveModel::Validations::ClassMethods
- ActiveModel::Validations::ConfirmationValidator
- ActiveModel::Validations::ExclusionValidator
- ActiveModel::Validations::FormatValidator
- ActiveModel::Validations::HelperMethods
- ActiveModel::Validations::InclusionValidator
- ActiveModel::Validations::LengthValidator
- ActiveModel::Validations::NumericalityValidator
- ActiveModel::Validations::PresenceValidator
- ActiveModel::Validations::WithValidator
- ActiveModel::Validator

No matching classes.

# ActiveModel::MassAssignmentSecurity::Sanitizer

### Public Class Methods

new(target=nil) click to toggle source

    # File lib/active_model/mass_assignment_security/sanitizer.rb, line 6
    def initialize(target=nil)
    end

### Public Instance Methods

sanitize(attributes, authorizer) click to toggle source

Returns all attributes not denied by the authorizer.

    # File lib/active_model/mass_assignment_security/sanitizer.rb, line 10
    def sanitize(attributes, authorizer)
      sanitized_attributes = attributes.reject { |key, value| authorizer.deny?(key) }
      debug_protected_attribute_removal(attributes, sanitized_attributes)
      sanitized_attributes
    end

### Protected Instance Methods

debug_protected_attribute_removal(attributes, sanitized_attributes) click to toggle source

    # File lib/active_model/mass_assignment_security/sanitizer.rb, line 18
    def debug_protected_attribute_removal(attributes, sanitized_attributes)
      removed_keys = attributes.keys - sanitized_attributes.keys
      process_removed_attributes(removed_keys) if removed_keys.any?
    end

process_removed_attributes(attrs) click to toggle source

    # File lib/active_model/mass_assignment_security/sanitizer.rb, line 23
    def process_removed_attributes(attrs)
      raise NotImplementedError, "#process_removed_attributes(attrs) suppose to be overwritten"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.