mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Minor doc fix related to ActiveModel::SecurePassword [ci skip]
This commit is contained in:
parent
67d0c9ee93
commit
d61aec316a
1 changed files with 5 additions and 2 deletions
|
@ -416,7 +416,6 @@ the Active Model API.
|
|||
```ruby
|
||||
class Person
|
||||
include ActiveModel::Model
|
||||
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -467,7 +466,7 @@ In order to make this work, the model must have an accessor named `password_dige
|
|||
The `has_secure_password` will add the following validations on the `password` accessor:
|
||||
|
||||
1. Password should be present.
|
||||
2. Password should be equal to its confirmation.
|
||||
2. Password should be equal to its confirmation (provided +password_confirmation+ is passed along).
|
||||
3. The maximum length of a password is 72 (required by `bcrypt` on which ActiveModel::SecurePassword depends)
|
||||
|
||||
#### Examples
|
||||
|
@ -493,6 +492,10 @@ person.valid? # => false
|
|||
person.password = person.password_confirmation = 'a' * 100
|
||||
person.valid? # => false
|
||||
|
||||
# When only password is supplied with no password_confirmation.
|
||||
person.password = 'aditya'
|
||||
person.valid? # => true
|
||||
|
||||
# When all validations are passed.
|
||||
person.password = person.password_confirmation = 'aditya'
|
||||
person.valid? # => true
|
||||
|
|
Loading…
Reference in a new issue