不要怂,就是干,撸起袖子干!

Commit d524adc8 by Jan Aagaard Meier

[ci skip] 📝 Update nested creation example for belongsTo. #6027

1 parent 9b90e788
Showing with 3 additions and 1 deletions
...@@ -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
return Product.create({ return Product.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.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!