Skip to content

Commit

Permalink
Merge pull request mde#598 from troyastorino/v0.12
Browse files Browse the repository at this point in the history
Updated documentation to expose behavior of validateWithParams
  • Loading branch information
mde committed May 11, 2014
2 parents 98366e3 + 1645d21 commit 32f2d13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/reference/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,21 @@ Sets up a validation to make sure that the property has been confirmed.
- `property [string]`: the name of the property to validate

##### fn
- `fn [function]`: a function which, when passed the value of the property, will return true or false
- `fn [function]`: a function which will return true or false. It is passed two
arguments: the value of the property, and an object mapping from the model instance's
properties to the values for those properties

##### options
- `on [string|array]`: specifies when validation happens (defaults to ['create', 'update'])
- `message [string]`: a message to give the user if the validation fails

##### example
```
this.validatesWithFunction('password', function (val) {
this.validatesWithFunction('password', function (val, params) {
// Something that returns true or false
return val.length > 0;
});
// uses the function to see if th length of password is greater than 0
// uses the function to see if the length of password is greater than 0
```

* * *
Expand Down

0 comments on commit 32f2d13

Please sign in to comment.