I try to implement BackboneRelational and keep getting
"It is not possible to instantiate more than one Backbone.RelationalModel with the same identifier for each type!"
class App.Models.User extends Backbone.RelationalModel urlRoot : '/api/users' idAttribute: 'id' relations: [ type: Backbone.HasMany key: 'plots' relatedModel: 'App.Models.Plot' collectionType: 'App.Collections.Plots' includeInJSON: false reverseRelation: key: 'user_id', includeInJSON: 'id' ] class App.Models.Plot extends Backbone.RelationalModel urlRoot : '/api/plots' idAttribute: 'id'
If I switch one of the models to the Backbone.Model extension, I can create an instance of both, but I get all warnings that the relational functionality is not working.
I am trying to achieve the following:
plot = new App.Models.Plot({id : 700}) plot.fetch() plot.get('user')
What am I missing?
Stpn
source share