mercredi 30 mars 2016

ember data findRecord returns string

A short question here.

I have the following statement in my route:

user_id: Ember.computed(function(){
    return `${this.get('session.data.authenticated.user_id')}`;
}),

user: Ember.computed(function(){
    let uid = this.get('user_id');
    return this.store.findRecord('user', uid);
}),

But I'm not sure how to work with what it's returning?

<(subclass of Ember.ObjectProxy):ember462>

I ultimately want to use this user object to set up a relation, with this statement:

model(params){
    let user = this.get('user');
    return this.store.createRecord('bizinfo', {'user': user});
},

However when I do, the relation attribute of the record is null.

user: null




Aucun commentaire:

Enregistrer un commentaire