I'm still wrapping my head around Spine JS, its really clever cool stuff. I see it has support for Model Relationships but I can't seem to find any information about has_many :through
relationships.
I'm guessing its not possible, does anyone know if it is?
Half a decade late, but Spine.js does not have a has_many
relation.
Quoting the source code, it only has belongsTo, hasOne and 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();
};
}
});