From 7f155966abf137aaf6e2c57663c4096e1682122e Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Sat, 13 Sep 2014 00:03:08 +0200 Subject: [PATCH] Fix to handle new isNewRecord implementation --- lib/relation-definition.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 072f9743..2590a3a5 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -2020,7 +2020,12 @@ EmbedsMany.prototype.prepareEmbeddedInstance = function(inst) { var self = this; var propertyName = this.definition.keyFrom; var modelInstance = this.modelInstance; - inst.__persisted = true; + if (this.definition.options.persistent) { + var pk = this.definition.keyTo; + inst.__persisted = !!inst[pk]; + } else { + inst.__persisted = true; + } inst.triggerParent = function(actionName, callback) { if (actionName === 'save' || actionName === 'destroy') { var embeddedList = self.embeddedList();