Skip to content
Browse files

Fixes issue with the signature of validatesLength in the docs and add…

…s the option parameter to all of the validates* functions
  • Loading branch information...
1 parent ad88199 commit dfd0f5040dbefb883f8c048fed04e7fc692cb41c MiguelMadero committed
Showing with 18 additions and 6 deletions.
  1. +18 −6 docs/4-models.md
View
24 docs/4-models.md
@@ -64,13 +64,16 @@ this.property('premium', 'boolean');
* * *
#### .validatesPresent
-`validatesPresent(property)`
+`validatesPresent(property, options)`
Sets up a validation to make sure that the property is present.
##### property
- `property [string]`: the name of the property to validate
+##### options
+- `message [string]`: a message to give the user if the validation fails
+
##### example
```
this.validatesPresent('login');
@@ -91,7 +94,7 @@ Sets up a validation to make sure that the property is formatted correctly.
- `regex [regex]`: a regular expression that the property value must pass
##### options
-- `message [string]`: a message to give the use if the validation fails
+- `message [string]`: a message to give the user if the validation fails
##### example
```
@@ -102,17 +105,20 @@ this.validatesFormat('login', /[a-z]+/, {message: 'cannot contain numbers'});
* * *
#### .validatesLength
-`validatesLength(property, options)`
+`validatesLength(property, qualifier, options)`
Sets up a validation to make sure that the property meets certain length requirements.
##### property
- `property [string]`: the name of the property to validate
-##### options
+##### qualifier
- `min [number]`: the minimum length of the property
- `max [number]`: the maximum length of the property
+##### options
+- `message [string]`: a message to give the user if the validation fails
+
##### example
```
this.validatesLength('login', {min: '3'});
@@ -126,7 +132,7 @@ this.validatesLength('login', {max: '20'});
* * *
#### .validatesConfirmed
-`validatesConfirmed(property, param)`
+`validatesConfirmed(property, param, options)`
Sets up a validation to make sure that the property has been confirmed.
@@ -136,6 +142,9 @@ Sets up a validation to make sure that the property has been confirmed.
##### param
- `param [string]`: the param required to match
+##### options
+- `message [string]`: a message to give the user if the validation fails
+
##### example
```
this.validatesConfirmed('password', 'confirmPassword');
@@ -145,7 +154,7 @@ this.validatesConfirmed('password', 'confirmPassword');
* * *
#### .validatesWithFunction
-`validatesWithFunction(property, fn)`
+`validatesWithFunction(property, fn, options)`
Sets up a validation to make sure that the property has been confirmed.
@@ -155,6 +164,9 @@ Sets up a validation to make sure that the property has been confirmed.
##### fn
- `fn [function]`: a function which, when passed the value of the property, will return true or false
+##### options
+- `message [string]`: a message to give the user if the validation fails
+
##### example
```
this.validatesWithFunction('password', function (val) {

0 comments on commit dfd0f50

Please sign in to comment.
Something went wrong with that request. Please try again.