aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2018-06-28 13:01:21 +0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2018-06-28 13:01:21 +0200
commit08dde0f355e0450bc2cb7e0b4b95a0ec18d1a870 (patch)
treef1c06303e8b2b3a3eb5b82fd177f9c906af68b57 /activemodel/CHANGELOG.md
parent235809f6f2019f02936b3f95720acfc4d5b93abe (diff)
parent9b63bf1dfda36c61802165b2683761d2bb0d2110 (diff)
downloadrails-08dde0f355e0450bc2cb7e0b4b95a0ec18d1a870.tar.gz
rails-08dde0f355e0450bc2cb7e0b4b95a0ec18d1a870.tar.bz2
rails-08dde0f355e0450bc2cb7e0b4b95a0ec18d1a870.zip
Merge pull request #26764 from choncou/improve_has_secure_password
Allow configurable attribute name on `#has_secure_password`
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index dcf94a5e21..1a464c2ffd 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,3 +1,21 @@
+* Allows configurable attribute name for `#has_secure_password`. This
+ still defaults to an attribute named 'password', causing no breaking
+ 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.activation_token = "a_new_token"
+ user.activation_token_digest # => "$2a$10$0Budk0Fi/k2CDm2PEwa3Be..."
+ user.authenticate_activation_token('a_new_token') # => user
+
+ *Unathi Chonco*
+
* Add `config.active_model.i18n_full_message` in order to control whether
the `full_message` error format can be overridden at the attribute or model
level in the locale files. This is `false` by default.