Skip to content

Instantly share code, notes, and snippets.

@GerkinDev
Created June 10, 2017 12:20
Show Gist options
  • Save GerkinDev/429433c07cb69450ada4619b32cce1b8 to your computer and use it in GitHub Desktop.
Save GerkinDev/429433c07cb69450ada4619b32cce1b8 to your computer and use it in GitHub Desktop.
Backbone relational
var scope = {};
Backbone.Relational.store.addModelScope(scope);
scope.Foo = Backbone.RelationalModel.extend();
scope.Bar = Backbone.RelationalModel.extend({
relations: [
{
key:'foo',
relatedModel:'Foo',
type:'HasOne',
reverseRelation:{
key:'bar',
includeInJSON:'id',
model:'Bar'
}
}
]
});
Relation= Object { instance: null, reverseRelation: Object, options: Object, key: "foo", keySource: "foo", keyDestination: "foo", model: Window → index2.html, relatedModel: n() } : model does not inherit from Backbone.RelationalModel ( null ). backbone-relational.min.js:1:8090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment