Skip to content

Commit f8c9a4d

Browse files
committed
Remove MassAssignmentSecurity from ActiveModel
This will be moved out to protected_attributes gem
1 parent a8f6d5c commit f8c9a4d

16 files changed

+15
-816
lines changed

Diff for: activemodel/lib/active_model.rb

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ module ActiveModel
3636
autoload :EachValidator, 'active_model/validator'
3737
autoload :ForbiddenAttributesProtection
3838
autoload :Lint
39-
autoload :MassAssignmentSecurity
4039
autoload :Model
4140
autoload :Name, 'active_model/naming'
4241
autoload :Naming

Diff for: activemodel/lib/active_model/forbidden_attributes_protection.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ class ForbiddenAttributes < StandardError
33
end
44

55
module ForbiddenAttributesProtection
6-
def sanitize_for_mass_assignment(new_attributes, options = {})
7-
if !new_attributes.respond_to?(:permitted?) || (new_attributes.respond_to?(:permitted?) && new_attributes.permitted?)
8-
super
9-
else
6+
def sanitize_for_mass_assignment(attributes, options = {})
7+
if attributes.respond_to?(:permitted?) && !attributes.permitted?
108
raise ActiveModel::ForbiddenAttributes
9+
else
10+
attributes
1111
end
1212
end
1313
end

Diff for: activemodel/lib/active_model/mass_assignment_security.rb

-350
This file was deleted.

0 commit comments

Comments
 (0)