diff options
author | Tsutomu Kuroda <t-kuroda@oiax.jp> | 2011-01-26 11:35:02 +0900 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-02-09 18:35:15 -0200 |
commit | ad31549ab3044afc336c05243481c0f663689584 (patch) | |
tree | 9e4d9d735616559ada74f756a18bb4facfa2104c /activemodel/test/models | |
parent | 9d8fdfec38a145e3f5074fd8dc0216630c268e32 (diff) | |
download | rails-ad31549ab3044afc336c05243481c0f663689584.tar.gz rails-ad31549ab3044afc336c05243481c0f663689584.tar.bz2 rails-ad31549ab3044afc336c05243481c0f663689584.zip |
Override attributes_protected_by_default when has_secure_password is called.
attr_protected should not be called, because it nullifies the
mass assignment protection that has been set by attr_accessible.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activemodel/test/models')
-rw-r--r-- | activemodel/test/models/administrator.rb | 10 | ||||
-rw-r--r-- | activemodel/test/models/visitor.rb | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/activemodel/test/models/administrator.rb b/activemodel/test/models/administrator.rb new file mode 100644 index 0000000000..a48f8b064f --- /dev/null +++ b/activemodel/test/models/administrator.rb @@ -0,0 +1,10 @@ +class Administrator + include ActiveModel::Validations + include ActiveModel::SecurePassword + include ActiveModel::MassAssignmentSecurity + + attr_accessor :name, :password_digest + attr_accessible :name + + has_secure_password +end diff --git a/activemodel/test/models/visitor.rb b/activemodel/test/models/visitor.rb new file mode 100644 index 0000000000..36c0a16688 --- /dev/null +++ b/activemodel/test/models/visitor.rb @@ -0,0 +1,9 @@ +class Visitor + include ActiveModel::Validations + include ActiveModel::SecurePassword + include ActiveModel::MassAssignmentSecurity + + has_secure_password + + attr_accessor :password_digest +end |