ignore some relationship fields on save
This commit is contained in:
parent
69e5f9eda8
commit
fdb142ecbf
|
@ -240,6 +240,26 @@ function wrap(db, dir) {
|
|||
var sql;
|
||||
var vals = [];
|
||||
|
||||
['hasOne', 'hasMany', 'hasAndBelongsToMany', 'belongsTo', 'belongsToMany'].forEach(function (relname) {
|
||||
var rels = opts[relname];
|
||||
|
||||
if (!rels) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Array.isArray(rels)) {
|
||||
rels = [rels];
|
||||
}
|
||||
|
||||
// don't save relationships
|
||||
rels.forEach(function (colname) {
|
||||
delete data[colname];
|
||||
delete data[camelCase(colname)];
|
||||
// TODO placehold relationships on find / get?
|
||||
// data[camelCase(colname)] = null;
|
||||
});
|
||||
});
|
||||
|
||||
(opts.indices || []).forEach(function (col) {
|
||||
if ('string' === typeof col) {
|
||||
col = { name: col, type: 'TEXT' };
|
||||
|
|
Loading…
Reference in New Issue