diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-07-17 00:59:31 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-16 23:58:19 -0500 |
commit | f8c9a4d3e88181cee644f91e1342bfe896ca64c6 (patch) | |
tree | 104ff8b5a28d37d4137b4e7ee783085825a823ba /activemodel/test/models | |
parent | a8f6d5c6450a7fe058348a7f10a908352bb6c7fc (diff) | |
download | rails-f8c9a4d3e88181cee644f91e1342bfe896ca64c6.tar.gz rails-f8c9a4d3e88181cee644f91e1342bfe896ca64c6.tar.bz2 rails-f8c9a4d3e88181cee644f91e1342bfe896ca64c6.zip |
Remove MassAssignmentSecurity from ActiveModel
This will be moved out to protected_attributes gem
Diffstat (limited to 'activemodel/test/models')
-rw-r--r-- | activemodel/test/models/account.rb | 5 | ||||
-rw-r--r-- | activemodel/test/models/administrator.rb | 4 | ||||
-rw-r--r-- | activemodel/test/models/mass_assignment_specific.rb | 83 | ||||
-rw-r--r-- | activemodel/test/models/visitor.rb | 3 |
4 files changed, 7 insertions, 88 deletions
diff --git a/activemodel/test/models/account.rb b/activemodel/test/models/account.rb new file mode 100644 index 0000000000..eed668d38f --- /dev/null +++ b/activemodel/test/models/account.rb @@ -0,0 +1,5 @@ +class Account + include ActiveModel::ForbiddenAttributesProtection + + public :sanitize_for_mass_assignment +end diff --git a/activemodel/test/models/administrator.rb b/activemodel/test/models/administrator.rb index 2d6d34b3e2..2f3aff290c 100644 --- a/activemodel/test/models/administrator.rb +++ b/activemodel/test/models/administrator.rb @@ -2,12 +2,10 @@ class Administrator extend ActiveModel::Callbacks include ActiveModel::Validations include ActiveModel::SecurePassword - include ActiveModel::MassAssignmentSecurity - + define_model_callbacks :create attr_accessor :name, :password_digest - attr_accessible :name has_secure_password end diff --git a/activemodel/test/models/mass_assignment_specific.rb b/activemodel/test/models/mass_assignment_specific.rb deleted file mode 100644 index 1bf828ad43..0000000000 --- a/activemodel/test/models/mass_assignment_specific.rb +++ /dev/null @@ -1,83 +0,0 @@ -class User - include ActiveModel::MassAssignmentSecurity - attr_protected :admin - - public :sanitize_for_mass_assignment -end - -class SpecialUser - include ActiveModel::MassAssignmentSecurity - attr_accessible :name, :email, :as => :moderator - - public :sanitize_for_mass_assignment -end - -class Person - include ActiveModel::MassAssignmentSecurity - attr_accessible :name, :email - attr_accessible :name, :email, :admin, :as => :admin - - public :sanitize_for_mass_assignment -end - -class SpecialPerson - include ActiveModel::MassAssignmentSecurity - include ActiveModel::ForbiddenAttributesProtection - - public :sanitize_for_mass_assignment -end - -class Account - include ActiveModel::MassAssignmentSecurity - attr_accessible :name, :email, :as => [:default, :admin] - attr_accessible :admin, :as => :admin - - public :sanitize_for_mass_assignment -end - -class Firm - include ActiveModel::MassAssignmentSecurity - - public :sanitize_for_mass_assignment - - def self.attributes_protected_by_default - ["type"] - end -end - -class Task - include ActiveModel::MassAssignmentSecurity - attr_protected :starting - - public :sanitize_for_mass_assignment -end - -class LoosePerson - include ActiveModel::MassAssignmentSecurity - attr_protected :credit_rating, :administrator - attr_protected :credit_rating, :as => :admin -end - -class LooseDescendant < LoosePerson - attr_protected :phone_number -end - -class LooseDescendantSecond< LoosePerson - attr_protected :phone_number - attr_protected :name -end - -class TightPerson - include ActiveModel::MassAssignmentSecurity - attr_accessible :name, :address - attr_accessible :name, :address, :admin, :as => :admin - - def self.attributes_protected_by_default - ["mobile_number"] - end -end - -class TightDescendant < TightPerson - attr_accessible :phone_number - attr_accessible :super_powers, :as => :admin -end diff --git a/activemodel/test/models/visitor.rb b/activemodel/test/models/visitor.rb index d15f448516..4d7f4be097 100644 --- a/activemodel/test/models/visitor.rb +++ b/activemodel/test/models/visitor.rb @@ -2,8 +2,7 @@ class Visitor extend ActiveModel::Callbacks include ActiveModel::Validations include ActiveModel::SecurePassword - include ActiveModel::MassAssignmentSecurity - + define_model_callbacks :create has_secure_password(validations: false) |