@@ -264,7 +264,7 @@ Model validations, allow you to specify format/content/inheritance valid
...
@@ -264,7 +264,7 @@ Model validations, allow you to specify format/content/inheritance valid
Validations are automatically run on `create`, `update` and `save`. You can also call `validate()` to manually validate an instance.
Validations are automatically run on `create`, `update` and `save`. You can also call `validate()` to manually validate an instance.
The validations are implemented by [validator][3].
The validations are implemented by [validator.js][3].
```js
```js
varValidateMe=sequelize.define('Foo',{
varValidateMe=sequelize.define('Foo',{
...
@@ -320,7 +320,7 @@ var ValidateMe = sequelize.define('Foo', {
...
@@ -320,7 +320,7 @@ var ValidateMe = sequelize.define('Foo', {
Note that where multiple arguments need to be passed to the built-in validation functions, the arguments to be passed must be in an array. But if a single array argument is to be passed, for instance an array of acceptable strings for `isIn`, this will be interpreted as multiple string arguments instead of one array argument. To work around this pass a single-length array of arguments, such as `[['one', 'two']]` as shown above.
Note that where multiple arguments need to be passed to the built-in validation functions, the arguments to be passed must be in an array. But if a single array argument is to be passed, for instance an array of acceptable strings for `isIn`, this will be interpreted as multiple string arguments instead of one array argument. To work around this pass a single-length array of arguments, such as `[['one', 'two']]` as shown above.
To use a custom error message instead of that provided by node-validator, use an object instead of the plain value or array of arguments, for example a validator which needs no argument can be given a custom message with
To use a custom error message instead of that provided by validator.js, use an object instead of the plain value or array of arguments, for example a validator which needs no argument can be given a custom message with
```js
```js
isInt:{
isInt:{
...
@@ -339,7 +339,7 @@ isIn: {
...
@@ -339,7 +339,7 @@ isIn: {
When using custom validator functions the error message will be whatever message the thrown`Error`object holds.
When using custom validator functions the error message will be whatever message the thrown`Error`object holds.
See [the node-validator project][4]for more details on the built in validation methods.
See [the validator.js project][4]for more details on the built in validation methods.
**Hint: **You can also define a custom function for the logging part. Just pass a function. The first parameter will be the string that is logged.
**Hint: **You can also define a custom function for the logging part. Just pass a function. The first parameter will be the string that is logged.