module ActiveModel::MassAssignmentSecurity::Sanitizer

Provides a patched version of the Sanitizer used in Rails to handle property and relationship objects as keys. There is no way to inject a custom sanitizer without reimplementing the permission sets.

Public Instance Methods

sanitize(attributes) click to toggle source

Returns all attributes not denied by the authorizer.

@param [Hash{Symbol,String,::DataMapper::Property,::DataMapper::Relationship=>Object}] attributes

Names and values of attributes to sanitize.

@return [Hash]

Sanitized hash of attributes.
# File lib/dm-rails/mass_assignment_security.rb, line 18
def sanitize(attributes)
  sanitized_attributes = attributes.reject do |key, value|
    key_name = key.name rescue key
    deny?(key_name)
  end
  debug_protected_attribute_removal(attributes, sanitized_attributes)
  sanitized_attributes
end