1
我仍然圍繞Spine JS,它的真正聰明的很酷的東西。我發現它支持Model Relationships,但我似乎無法找到關於has_many :through
關係的任何信息。Spine.js has_many:通過
我猜它不可能,有人知道它是否是?
我仍然圍繞Spine JS,它的真正聰明的很酷的東西。我發現它支持Model Relationships,但我似乎無法找到關於has_many :through
關係的任何信息。Spine.js has_many:通過
我猜它不可能,有人知道它是否是?
晚了十年,但Spine.js沒有has_many
關係。
引述source code,它只有屬於關聯,hasOne和的hasMany:
Spine.Model.extend({
hasMany: function(name, model, fkey) {
if (fkey == null) {
fkey = (underscore(this.className)) + "_id";
}
return this.prototype[name] = function(value) {
return association(name, model, this, fkey, Collection).refresh(value);
};
},
belongsTo: function(name, model, fkey) {
if (fkey == null) {
fkey = (underscore(singularize(name))) + "_id";
}
this.prototype[name] = function(value) {
return association(name, model, this, fkey, Instance).update(value).find();
};
return this.attributes.push(fkey);
},
hasOne: function(name, model, fkey) {
if (fkey == null) {
fkey = (underscore(this.className)) + "_id";
}
return this.prototype[name] = function(value) {
return association(name, model, this, fkey, Singleton).update(value).find();
};
}
});