title: ember data not saving foreign key, sent as null
body: <p>My ember app is not sending my foreign key to the back-end.</p>
  
  <p>I have a table called <em>issues</em> which is has a related table called <em>categories</em> </p>
  
  <p>My model is:</p>
  
  <pre><code>import DS from 'ember-data';
  
  export default DS.Model.extend({
      name:           DS.attr('string'),
      category_id:    DS.belongsTo('category'),
      description:    DS.attr('string')
  });
  </code></pre>
  
  <p>My route is:</p>
  
  <pre><code>import Ember from 'ember';
  
  export default Ember.Route.extend({
    model: function(){
      return this.store.findAll('issue');
    },
    actions: {
      create: function(){
  
          var issue = this.store.createRecord('issue');
          issue.name = this.get('controller').get('newName');
          issue.description = this.get('controller').get('newDescription');
          issue.category_id = parseInt(this.get('controller').get('newCategory'));
          //debugger;
  
          console.log(issue);
          issue.save();
      },
      ...
      other actions 
      ...
      }
    }
  });
  </code></pre>
  
  <p>the console.log from above looks like the category_id is getting set correctly:</p>
  
  <pre><code>category_id: 3
  description: "foobar"
  name: "test"
  </code></pre>
  
  <p>However my JSON payload that gets sent to the backend looks like:</p>
  
  <pre><code>{"issue":{"name":"test","description":"foobar","category_id":null}}
  </code></pre>
  
  <p>I tried stepping through by adding a custom serialiser in app/serializers/application.js</p>
  
  <pre><code>export default DS.RESTSerializer.extend({
    ...
  
      serialize: function(snapshot,options){
        console.debug('options='+options);
        debugger;
        var json = this._super(snapshot, options);;
  
        return json;
      }
    ...
    });
  </code></pre>
  
  <p>But I got lost in all the super calling super indirection.</p>
  
  <p>The <em>snapshot.record</em> has <code>category_id: 3</code>, but the <em>json</em> coming back from the this._super() call has <code>category_id: null</code></p>
  
  <p><em>options</em> has <code>includeID:true</code></p>
  
  <p>Any clues will be much appreciated ...</p>
  
  <p>Ember      : 2.0.2<br>
  Ember Data : 2.0.0</p>