add jsdoc and fix add data to referencesMany.add

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
This commit is contained in:
Clark Wang 2014-09-01 09:54:55 +08:00
parent 565b85555c
commit 86045d4792
1 changed files with 7 additions and 1 deletions

View File

@ -918,6 +918,7 @@ HasManyThrough.prototype.create = function create(data, done) {
/**
* Add the target model instance to the 'hasMany' relation
* @param {Object|ID} acInst The actual instance or id value
* @param {Object} [data] Optional data object for the through model to be created
*/
HasManyThrough.prototype.add = function (acInst, data, done) {
var self = this;
@ -2553,12 +2554,17 @@ ReferencesMany.prototype.build = function(targetModelData) {
* Add the target model instance to the 'embedsMany' relation
* @param {Object|ID} acInst The actual instance or id value
*/
ReferencesMany.prototype.add = function (acInst, cb) {
ReferencesMany.prototype.add = function (acInst, data, cb) {
var self = this;
var definition = this.definition;
var modelTo = this.definition.modelTo;
var modelInstance = this.modelInstance;
if (typeof data === 'function') {
cb = data;
data = {};
}
var pk = this.definition.keyTo;
var fk = this.definition.keyFrom;