diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 13:15:48 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 13:15:59 -0800 |
commit | fd2d78dbc89a5875fb6e70416b991b371ea33468 (patch) | |
tree | 460859245a0375d4e0c18f496cb0d1d3eda4d60a /activemodel | |
parent | 54b4e8e8d6a6bb5b8a27f2e9a6dbbc1a47fea4a0 (diff) | |
download | rails-fd2d78dbc89a5875fb6e70416b991b371ea33468.tar.gz rails-fd2d78dbc89a5875fb6e70416b991b371ea33468.tar.bz2 rails-fd2d78dbc89a5875fb6e70416b991b371ea33468.zip |
push target down to the classes that care about it
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(', ')}" |