Skip to content

Commit

Permalink
Merge pull request #26110 from aditya-kapoor/minor-doc-fix
Browse files Browse the repository at this point in the history
Minor doc fix related to ActiveModel::SecurePassword [ci skip]
  • Loading branch information
guilleiguaran committed Aug 11, 2016
2 parents 432222f + d61aec3 commit 5cb6b88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions guides/source/active_model_basics.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ the Active Model API.
```ruby ```ruby
class Person class Person
include ActiveModel::Model include ActiveModel::Model

end end
``` ```


Expand Down Expand Up @@ -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: The `has_secure_password` will add the following validations on the `password` accessor:


1. Password should be present. 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) 3. The maximum length of a password is 72 (required by `bcrypt` on which ActiveModel::SecurePassword depends)


#### Examples #### Examples
Expand All @@ -493,6 +492,10 @@ person.valid? # => false
person.password = person.password_confirmation = 'a' * 100 person.password = person.password_confirmation = 'a' * 100
person.valid? # => false person.valid? # => false
# When only password is supplied with no password_confirmation.
person.password = 'aditya'
person.valid? # => true
# When all validations are passed. # When all validations are passed.
person.password = person.password_confirmation = 'aditya' person.password = person.password_confirmation = 'aditya'
person.valid? # => true person.valid? # => true
Expand Down

0 comments on commit 5cb6b88

Please sign in to comment.