Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

push target down to the classes that care about it

  • Loading branch information...
commit fd2d78dbc89a5875fb6e70416b991b371ea33468 1 parent 54b4e8e
@tenderlove tenderlove authored
View
9 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 @@ def process_removed_attributes(attrs)
class LoggerSanitizer < Sanitizer
def initialize(target)
@target = target
- super
+ super()
end
def logger
@@ -43,6 +40,10 @@ def process_removed_attributes(attrs)
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(', ')}"
Please sign in to comment.
Something went wrong with that request. Please try again.