aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_model_basics.md
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2016-08-10 20:44:30 -0500
committerGitHub <noreply@github.com>2016-08-10 20:44:30 -0500
commit5cb6b887d410fcd1ea821b32374a17a94acdc413 (patch)
treede8a07100b5095cbb6bec02fba074aebd23ed132 /guides/source/active_model_basics.md
parent432222fae13c29b4696905d7c614bc80f67a6051 (diff)
parentd61aec316ab1b884f7d95621b4c6057c45830f4f (diff)
downloadrails-5cb6b887d410fcd1ea821b32374a17a94acdc413.tar.gz
rails-5cb6b887d410fcd1ea821b32374a17a94acdc413.tar.bz2
rails-5cb6b887d410fcd1ea821b32374a17a94acdc413.zip
Merge pull request #26110 from aditya-kapoor/minor-doc-fix
Minor doc fix related to ActiveModel::SecurePassword [ci skip]
Diffstat (limited to 'guides/source/active_model_basics.md')
-rw-r--r--guides/source/active_model_basics.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md
index e834aeadb1..732e553c62 100644
--- a/guides/source/active_model_basics.md
+++ b/guides/source/active_model_basics.md
@@ -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