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

Commit 7bf9f467 by Alessandro Zanardi

Update instances.md

Changed method `instance.updateAtttributes()` to `instance.update`, according to latest API to avoid confusion:
https://github.com/sequelize/sequelize/blob/f678009d7514b81a6f87e12b86360e9a597e3ca8/lib/instance.js#L765
1 parent 44d2dd90
Showing with 4 additions and 4 deletions
......@@ -84,12 +84,12 @@ task.title = 'a very different title now'
task.save().then(function() {})
 
// way 2
task.updateAttributes({
task.update({
title: 'a very different title now'
}).then(function() {})
```
It's also possible to define which attributes should be saved when calling `save`, by passing an array of column names. This is useful when you set attributes based on a previously defined object. E.g. if you get the values of an object via a form of a web app. Furthermore this is used internally for `updateAttributes`. This is how it looks like:
It's also possible to define which attributes should be saved when calling `save`, by passing an array of column names. This is useful when you set attributes based on a previously defined object. E.g. if you get the values of an object via a form of a web app. Furthermore this is used internally for `update`. This is how it looks like:
```js
task.title = 'foooo'
......@@ -98,8 +98,8 @@ task.save({fields: ['title']}).then(function() {
// title will now be 'foooo' but description is the very same as before
})
 
// The equivalent call using updateAttributes looks like this:
task.updateAttributes({ title: 'foooo', description: 'baaaaaar'}, {fields: ['title']}).then(function() {
// The equivalent call using update looks like this:
task.update({ title: 'foooo', description: 'baaaaaar'}, {fields: ['title']}).then(function() {
// title will now be 'foooo' but description is the very same as before
})
```
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!