aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
authorUnathi Chonco <choncou@Unathis-MacBook-Pro.local>2016-10-12 09:01:57 +0800
committerUnathi Chonco <choncou@Unathis-MacBook-Pro.local>2016-10-12 09:01:57 +0800
commit9b63bf1dfda36c61802165b2683761d2bb0d2110 (patch)
tree0744ede2fb6aca01e23af43a7b17c96249ad79b2 /activemodel/CHANGELOG.md
parent86a48b4da3cbd925d30b0fbe472edbda7171ea9e (diff)
downloadrails-9b63bf1dfda36c61802165b2683761d2bb0d2110.tar.gz
rails-9b63bf1dfda36c61802165b2683761d2bb0d2110.tar.bz2
rails-9b63bf1dfda36c61802165b2683761d2bb0d2110.zip
Remove method for regenerating a token, and update `#authenticate`.
This change now creates a method `#authenticate_XXX` where XXX is the configured attribute name on `#has_secure_password`. `#authenticate` is now an alias to this method when the attribute name is the default 'password'
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md17
1 files changed, 7 insertions, 10 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 0721655a9c..21ebe7e9ec 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,21 +1,18 @@
* Allows configurable attribute name for `#has_secure_password`. This
still defaults to an attribute named 'password', causing no breaking
- change. Also includes a convenience method `#regenerate_XXX` where
- +XXX+ is the name of the custom attribute name, eg:
+ change. There is a new method `#authenticate_XXX` where XXX is the
+ configured attribute name, making the existing `#authenticate` now an
+ alias for this when the attribute is the default 'password'.
+ Example:
class User < ActiveRecord::Base
has_secure_password :activation_token, validations: false
end
user = User.new()
- user.regenerate_activation_token
- user.activation_token # => "ME7abXFGvzZWJRVrD6Et0YqAS6Pg2eDo"
- user.activation_token_digest # => "$2a$10$0Budk0Fi/k2CDm2PEwa3Be..."
-
- The existing `#authenticate` method now allows specifying the attribute
- to be authenticated, but defaults to 'password', eg:
-
- user.authenticate('ME7abXFGvzZWJRVrD6Et0YqAS6Pg2eDo', :activation_token) # => user
+ user.activation_token = "a_new_token"
+ user.activation_token_digest # => "$2a$10$0Budk0Fi/k2CDm2PEwa3Be..."
+ user.authenticate_activation_token('a_new_token') # => user
*Unathi Chonco*