How to access ember model relation properties in routes/controllers?
<p>I'm using ember 2.7.0, and I am trying to set up my ember app with a currentUser.organization derived from the authenticated token.  I am able to resolve the currentUser, but I'm unable to resolve the properties of the user's organization in my routes/controllers.</p>

<p>My user model:</p>

<pre><code>import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),
  email: DS.attr('string'),
  organization: DS.belongsTo('organization', { polymorphic: true, async: false } )
});
</code></pre>

<p>I've created a service which pulls the user like this:</p>

<pre><code>//app/services/session-account.js    
import Ember from 'ember';
    import jwtDecode from 'npm:jwt-decode';
    const { inject: { service }, RSVP } = Ember;
    export default Ember.Service.extend({
      session: service('session'),
      store: service(),
      loadCurrentUser() {
        return new RSVP.Promise((resolve, reject) =&gt; {
          const token = this.get('session.data').authenticated.access_token;
          if (!Ember.isEmpty(token)) {
            var token_payload = jwtDecode(token);
            return this.get('store').findRecord('user', token_payload.user_id, { include: 'organization' }).then((user) =&gt; {
              this.set('account', user);
              this.set('organization', user.organization);
              resolve();
            }, reject);
          } else {
            resolve();
          }
        });
      }
    });
</code></pre>

<p>I'm triggering loadCurrentUser after the user logs in, and I've verified it successfully fetches the user from the back-end (and the organization data is included in the jsonapi response), but while I can inject the service into my controllers/routes and access the user and fetch its direct properties, I can't access any properties of the related organization, via either <code>myservice.get('currentUser.organization.name')</code> (comes back undefined), or <code>myservice.get('currentOrganization.name')</code>, which throws the following error:
<code>Uncaught TypeError: Cannot read property '_relationships' of undefined</code>.</p>

<p>If I load a user as a model and reference properties of the user.organization in a template, everything works fine- but on the javascript side, I can't get to the organization model. </p>

<p>EDIT:
  I've subsequently tried the following variant:</p>

<pre><code>return this.get('store').findRecord('user', token_payload.user_id, { include: 'organization' }).then((user) =&gt; {
  this.set('currentUser', user);
  user.get('organization').then((organization) =&gt; {
    this.set('currentOrganization', organization);
  }, reject);
  resolve();
}, reject);
</code></pre>

<p>and this version (which draws from the ember guides relationship documentation) throws the error TypeError: user.get(...).then is not a function</p>