Skip to content

Commit

Permalink
Remove MassAssignmentSecurity from ActiveModel
Browse files Browse the repository at this point in the history
This will be moved out to protected_attributes gem
  • Loading branch information
guilleiguaran committed Sep 17, 2012
1 parent a8f6d5c commit f8c9a4d
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 816 deletions.
1 change: 0 additions & 1 deletion activemodel/lib/active_model.rb
Expand Up @@ -36,7 +36,6 @@ module ActiveModel
autoload :EachValidator, 'active_model/validator'
autoload :ForbiddenAttributesProtection
autoload :Lint
autoload :MassAssignmentSecurity
autoload :Model
autoload :Name, 'active_model/naming'
autoload :Naming
Expand Down
Expand Up @@ -3,11 +3,11 @@ class ForbiddenAttributes < StandardError
end

module ForbiddenAttributesProtection
def sanitize_for_mass_assignment(new_attributes, options = {})
if !new_attributes.respond_to?(:permitted?) || (new_attributes.respond_to?(:permitted?) && new_attributes.permitted?)
super
else
def sanitize_for_mass_assignment(attributes, options = {})
if attributes.respond_to?(:permitted?) && !attributes.permitted?
raise ActiveModel::ForbiddenAttributes
else
attributes
end
end
end
Expand Down
350 changes: 0 additions & 350 deletions activemodel/lib/active_model/mass_assignment_security.rb

This file was deleted.

0 comments on commit f8c9a4d

Please sign in to comment.