@@ -745,7 +745,7 @@ A new `Product` and `User` can be created in one step in the following way:
...
@@ -745,7 +745,7 @@ A new `Product` and `User` can be created in one step in the following way:
```js
```js
returnProduct.create({
returnProduct.create({
title:'Chair',
title:'Chair',
User:{
user:{
first_name:'Mick',
first_name:'Mick',
last_name:'Broadstone'
last_name:'Broadstone'
}
}
...
@@ -754,6 +754,8 @@ return Product.create({
...
@@ -754,6 +754,8 @@ return Product.create({
});
});
```
```
Here, our user model is called `user`, with a lowercase u - This means that the property in the object should also be `user`. If the name given to `sequelize.define` was `User`, the key in the object should also be `User`.
### Creating elements of a "BelongsTo" association with an alias
### Creating elements of a "BelongsTo" association with an alias
The previous example can be extended to support an association alias.
The previous example can be extended to support an association alias.