Why do we need *ToNone relationships-Collection of common programming errors

Why do we need *toNone relationship?

If i not set inverse relations to Models f.e:

  App.Post = DS.Model.extend({
    comments: DS.hasMany('App.Comment')
  });

  App.Comment = DS.Model.extend({
    post: DS.belongsTo('App.Post')  // i dont want to set it
  });

Ember data creates *ToNone relationshipChange, and in future when i delete the record (in our case it is instance of App.Comment) ember will delete all relationships connected with my record, including *ToNone relations with removeRelationshipChangeFor method.

If i have ManyToOne relationship type inside removeRelationshipChangeFor i will get an error “Cannot read property ‘clientId’ of undefined”. It happens because i dont have clientReference in ManyToNone relation.

So what is the purpose of storing *ToNone relations?

Originally posted 2013-11-09 21:20:38.