Methods

ActiveModel::MassAssignmentSecurity

Public Instance Methods

sanitize(attributes, authorizer = nil) 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, authorizer = nil)
  sanitized_attributes = attributes.reject do |key, value|
    key_name = key.name rescue key
    authorizer ? authorizer.deny?(key_name) : deny?(key_name)
  end
  debug_protected_attribute_removal(attributes, sanitized_attributes)
  sanitized_attributes
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.