sequelize/sequelize — pull request #797 by durango (2013-07-31 04:07:17+00:00)
Title: bulkCreate() now has a third argument which gives you the ability to validate each row before attempting to bulkInsert.

bulkCreate was originally made to be a mainstream/fast way of inserting records, however, sometimes you want the luxury of being able to insert multiple rows at once without sacrificing model validations. I've added a third argument to bulkCreate which is an object and currently the only option is ```{validate: true}``` I actually need this for my workplace, so please do review the PR let me know what you don't like (if anything) etc.

The following code...

```js
var Tasks = this.sequelize.define('Task', {
name: {
type: Sequelize.STRING,
validate: {
notNull: { args: true, msg: 'name cannot be null' }
}
},
code: {
type: Sequelize.STRING,
validate: {
len: [3, 10]
}
}
})

Tasks.sync({ force: true }).success(function() {
Tasks.bulkCreate([
{name: 'foo', code: '123'},
{code: '1234'},
{name: 'bar', code: '1'}
], null, {validate: true}).error(function(errors) {
// console.log(errors)
})
})
```

Produces this errors object:

```js
[
{
"record": {
"code": "1234"
},
"errors": {
"name": [
"name cannot be null"
]
}
},
{
"record": {
"name": "bar",
"code": "1"
},
"errors": {
"code": [
"String is not in range: code"
]
}
}
]
```

Which would allow you to not only see the errors, but which records were the offenders.