diff options
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/mass_assignment_security/sanitizer.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb index caf2a25573..33259b98bd 100644 --- a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb +++ b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb @@ -1,9 +1,6 @@ module ActiveModel module MassAssignmentSecurity class Sanitizer - def initialize(target=nil) - end - # Returns all attributes not denied by the authorizer. def sanitize(attributes, authorizer) sanitized_attributes = attributes.reject { |key, value| authorizer.deny?(key) } @@ -26,7 +23,7 @@ module ActiveModel class LoggerSanitizer < Sanitizer def initialize(target) @target = target - super + super() end def logger @@ -43,6 +40,10 @@ module ActiveModel end class StrictSanitizer < Sanitizer + def initialize(target = nil) + super() + end + def process_removed_attributes(attrs) return if (attrs - insensitive_attributes).empty? raise ActiveModel::MassAssignmentSecurity::Error, "Can't mass-assign protected attributes: #{attrs.join(', ')}" |