title: Sending REST requests to a nested API endpoint URL using Ember Data
body: <p>If you imagine two models defined thus:</p>
  
  <pre><code>App.User = DS.Model.extend({
      emails: DS.hasMany('email', {embedded: 'always'}),
  });
  
  App.Email = DS.Model.extend({
      address: DS.attr('string'),
      alias: DS.attr('string'),
      user: DS.belongsTo('user')
  });
  </code></pre>
  
  <p>... and a REST Adapter:</p>
  
  <pre><code>App.UserAdapter = DS.RESTAdapter.extend({
      url: 'http://whatever.com',
      namespace: 'api/v1'
  });
  </code></pre>
  
  <p>... with routing set up like so:</p>
  
  <pre><code>App.Router.map(function () {
      this.route('index', { path: '/' });
      this.resource('users', function () {
          this.route('index');
          this.route('add');
          this.resource('user', { path: ':user_id' }, function () {
              this.route('delete');
              this.route('edit');
              this.resource('emails', function () {
                  this.route('index');
                  this.route('add');
                  this.resource('email', { path: ':email_id' }, function () {
                      this.route('delete');
                      this.route('edit');
                  });
              });
          });
      });
  });
  </code></pre>
  
  <p>... and a controller action to save the edited email, which looks like this:</p>
  
  <pre><code>App.EmailEditController = Ember.ObjectController.extend({
      actions: {
          save: function () {
              var self = this;
              var email = this.get('model');
              email.save().then(function(){
                  self.transitionToRoute('email', email);
              });
          }
      }
  });
  </code></pre>
  
  <p>The issue is this...</p>
  
  <p>The PUT request is being sent to: <a href="http://whatever.com/api/v1/emails/%5bemail_id%5d" rel="nofollow">http://whatever.com/api/v1/emails/[email_id]</a></p>
  
  <p>However the correct API endpoint is: <a href="http://whatever.com/api/v1/users/%5buser_id%5d/emails/%5bemail_id%5d" rel="nofollow">http://whatever.com/api/v1/users/[user_id]/emails/[email_id]</a></p>
  
  <p>What is the correct way to remedy this issue?</p>