Class: ActiveModel::MassAssignmentSecurity::StrictSanitizer

Inherits:
Sanitizer
  • Object
show all
Defined in:
lib/mongomodel/vendor/active_model/mass_assignment_security/sanitizer.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Sanitizer

#sanitize

Constructor Details

#initialize(target = nil) ⇒ StrictSanitizer

Returns a new instance of StrictSanitizer



54
55
56
# File 'lib/mongomodel/vendor/active_model/mass_assignment_security/sanitizer.rb', line 54

def initialize(target = nil)
  super()
end

Instance Method Details

#insensitive_attributesObject



63
64
65
# File 'lib/mongomodel/vendor/active_model/mass_assignment_security/sanitizer.rb', line 63

def insensitive_attributes
  ['id']
end

#process_removed_attributes(klass, attrs) ⇒ Object



58
59
60
61
# File 'lib/mongomodel/vendor/active_model/mass_assignment_security/sanitizer.rb', line 58

def process_removed_attributes(klass, attrs)
  return if (attrs - insensitive_attributes).empty?
  raise ActiveModel::MassAssignmentSecurity::Error.new(klass, attrs)
end