bookshelf-strip-save
v1.0.5
Published
Avoid column doesn't exist errors when saving in Bookshelf.js
Downloads
4
Readme
Bookshelf Strip Save
This plugin works with Bookshelf.js, available here http://bookshelfjs.org. This plugin will automatically strip any attributes set on a model that's not the name of a column of its associated table before it's saved. This is useful for example if you are receiving "dirty" data.
It does this by relying on bookshelf-column-cache to check for a whitelist of valid column names.
requires async syntax to work.
Installation
npm install bookshelf-strip-save bookshelf-column-cache
Then in your bookshelf configuration:
var bookshelf = require('bookshelf')(knex);
bookshelf.plugin(require('bookshelf-strip-save');
bookshelf.plugin(require('bookshelf-column-cache');