aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models
diff options
context:
space:
mode:
authorUnathi Chonco <choncou@Unathis-MacBook-Pro.local>2016-10-12 01:01:01 +0800
committerUnathi Chonco <choncou@Unathis-MacBook-Pro.local>2016-10-12 01:02:27 +0800
commit86a48b4da3cbd925d30b0fbe472edbda7171ea9e (patch)
tree43bb5b6b618a1f7415353a6b6a497785ea481baf /activemodel/test/models
parent32617a2ca3aec1b2649eb86d2b698a0ee04dcb8a (diff)
downloadrails-86a48b4da3cbd925d30b0fbe472edbda7171ea9e.tar.gz
rails-86a48b4da3cbd925d30b0fbe472edbda7171ea9e.tar.bz2
rails-86a48b4da3cbd925d30b0fbe472edbda7171ea9e.zip
This addition will now allow configuring an attribute name for the
existing `#has_secure_password`. This can be useful when one would like to store some secure field as a digest, just like a password. The method still defaults to `password`. It now also allows using the same `#authenticate` method which now accepts a second argument for specifying the attribute to be authenticated, or will default to 'password`. A new method is also added for generating a new token for an attribute by calling `#regenerate_XXXX` where `XXXX` is the attribute name.
Diffstat (limited to 'activemodel/test/models')
-rw-r--r--activemodel/test/models/user.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/test/models/user.rb b/activemodel/test/models/user.rb
index 6556b1a7d9..ab424efb9b 100644
--- a/activemodel/test/models/user.rb
+++ b/activemodel/test/models/user.rb
@@ -5,6 +5,7 @@ class User
define_model_callbacks :create
has_secure_password
+ has_secure_password :activation_token, validations: false
- attr_accessor :password_digest
+ attr_accessor :password_digest, :activation_token_digest
end