balderdashy/waterline — pull request #649 by connor4312 (2014-09-22 12:43:17+00:00)
Title: Added guarding/fill ability to waterline models

Previously, there wasn't a really _good_ way of updating a model's attributes en masse (e.g. from form input) without manually filtering out attributes you didn't want to have the user be able to set. That doesn't lend itself to very DRY design, and is a pain in the neck!

I've added the ability to denoted "guarded" properties of the model, then use a method "fill" to effectively extend the model based on dirty input.

For example, you can have a model like:
```js
{
attributes: {
id: {
type: 'integer',
autoIncrement: true,
primaryKey: true,
unique: true
},
email: { type: 'email' }
},
guarded: ['id']
}
```

Now, by calling `model.fill(input)`, the user would only be able to change their email, _not_ their ID. Additionally, anything given in the "input" which is not an attribute of the model will be discarded.