title: backbone relational : Uncaught TypeError: Cannot read property 'id' of null
body: <p>I'm having a problem trying to implement the <strong>backbone relational</strong> within our application.</p>
  <p>I get this error after i try to fetch a RelationalModel:
  <strong>Uncaught TypeError: Cannot read property 'id' of null</strong></p>
  <h2>This is the module</h2>
  <pre><code>App.Models.Story = Backbone.RelationalModel.extend({
  urlRoot: '/rest/v1/story/',
  url:function(){
       if (this.isNew()) {
            return this.urlRoot;
      } else {
       return  this.urlRoot + this.id + &quot;/&quot;;
      } 
  },
  idAttribute: 'id',
  relations: [{
        type: Backbone.HasMany,
        key: 'pieces',
        createModels: true,
        relatedModel: 'App.Models.Piece',
        collectionType: 'App.Collections.Pieces',
        includeInJSON: false,
        reverseRelation: {
           key: 'story'
       }
    }],
       initialize: function(){
           this.get('pieces').url = _.bind(function(){
               return this.url() + &quot;piece/&quot;
           }, this);
          console.log(&quot;hello from story model&quot;);
      }
  });
  </code></pre>
  <p><strong>This is the collection</strong></p>
  <pre><code> App.Collections.Stories = Backbone.Collection.extend({
   url:'/rest/v1/story/',
   model: App.Models.Story
  });
  </code></pre>
  <p>I retrieve data from my API like this</p>
  <pre><code>get all stories    : GET /rest/v1/story/
  get story no' 10   : GET /rest/v1/story/10/
  get story pieces   : GET /rest/v1/story/10/piece/
  get piece no' 612  : GET /rest/v1/piece/612/
  </code></pre>
  <p>Now when i try to do</p>
  <pre><code>var story = App.Models.Story({id:10});
  story.fetch()
  </code></pre>
  <p>I get this error:
  <strong>Uncaught TypeError: Cannot read property 'id' of null</strong></p>
  <p>The Object itself created successfully trough the responded Json.</p>
  <p>The error breaks the RelationalModel from setting up the relations.</p>
  <p>Thanks.</p>